Yes I'm running it with command-line arguments. And I added a cin, but I don't get an answer back. When i write an expression and press enter all I get is "Press any key to continue...". I can't figure out what's wrong.
1 2 3 4 5 6 7 8 9 10
int main(int argc, char* argv[])
{
cin >> TokenValue;
if (argc>1)
{
double Value = Utvardering(argv[1]);
cout << Value << endl;
}
return 0;
}
I have taken your original posted code, added the one change mentioned in my first post. Compiled it to test.exe. At the command line, entered 'test 2+2' and the program returned 4.
Try
1 2 3 4 5 6 7 8 9 10 11 12 13
int main(int argc, char* argv[])
{
if (argc>1)
{
double Value = Utvardering(argv[1]);
cout << Value << endl;
}
else
{
cout << "Usage: " << argv[0] << " expresion" << endl;
}
return 0;
}
Can you post your full code? I can then step through it to evaluate an expression and see what it is doing. I’m having trouble following it at the moment.