#include <iostream>
#include "calc.h"
using namespace std;

int main(int argc, char * argv[])
{
	ExprCalc::Calc c;
	std::string expression;
	char buffer[1024];
	cout << "Welcome to Expression Calculator (c) 2005 By ramirez ^^;;;" << endl <<
			"You can use CTRL+C to quit" << endl << endl;
	while (true) {
		expression = "";
		cin.getline(buffer, 1024);
		while (cin.fail()) {
			cin.clear();
			while (cin.get() != '\n') {}
			cin.getline(buffer, 1024);
		}
		expression = buffer;
		if (c.Parse(expression))
			cout << "\t" << c.GetResult() << endl;
		else
			cout << "\tError: " << c.GetError() << endl;
	}
	return 0;
}
