I am trying to read in a file that is similar to this:
push 10
pop
push 20
push 30
pop
push 10
push 50
push 20
push 20
pop
I am trying to make it so if it says push then it uses the pushfunction to push 10. And when it says pop it will pop off the top of the stack. Etc...
When you read in a file how do you make it read in the string, then use the integer?
That is what I have to read in the code but I am just stuck on how to store it then use it.Code:getline(cin, fileAddress); ifstream textFile (fileAddress); //Tests the file if (textFile.fail()) { cout << "File was not found"<< endl; system("PAUSE"); exit (1); } else cout << "\nFile opened successfully" << endl;
Thanks for the help!
Bookmarks