This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
csce420pine64backup/hw2/hw2pr1/hw2pr1.cpp

80 lines
1.5 KiB
C++
Raw Normal View History

2017-10-25 07:34:40 -05:00
// Name: Alexander Huddleston UIN: 223000555
// CSCE 420
// Due: 11:59 P.M. Monday, October 30, 2017
// hw2pr1.cpp
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <math.h>
#include "node.h"
using namespace std;
node makeTree(string input, node n, int level)
{
char tempc = input[0];
input = input.substr(1);
if(tempc == '(')
{
}
while(input.length() != 0)
{
2017-10-25 08:45:19 -05:00
// If the char is a digit.
2017-10-25 07:34:40 -05:00
if(tempc)
{
}
2017-10-25 08:45:19 -05:00
// If the char is a comma.
else if(tempc == ',')
{
}
// If the char is a close paranthesis.
else if(tempc == ')')
{
}
2017-10-25 07:34:40 -05:00
}
}
int main(int argc, char **argv)
{
// Initialization of input string.
string input = "";
// For testing, I want to read from a file.
// Typing in an tree from the keyboard each execution is a waste of time.
if(argc > 1)
{
if(!((string)argv[1]).substr(0, 2).compare("-f"))
{
ifstream file;
string line;
try
{
file.open("hw2pr1_data.txt");
}
catch(exception e)
{
cerr << "File not found, or could not be opened." << endl;
}
while(!file.eof())
{
getline(file, line);
input += line;
}
}
}
else
{
cout << "Please input a tree: ";
cin >> input;
}
cout << input << endl;
return 0;
}