79 lines
1.5 KiB
C++
79 lines
1.5 KiB
C++
// 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)
|
|
{
|
|
// If the char is a digit.
|
|
if(tempc)
|
|
{
|
|
}
|
|
|
|
// If the char is a comma.
|
|
else if(tempc == ',')
|
|
{
|
|
}
|
|
|
|
// If the char is a close paranthesis.
|
|
else if(tempc == ')')
|
|
{
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|