I have one last question. In my last program that I wrote I had a statement which looked like this:
When reading from a file reached eof the while loop would be finished and the program terminal window would close, or if there was no input file specified and the input was coming from the keyboard instead, if the user just hit return without typing anything the program would exit, too. Now, I have what I thought was the exact same loop structure in this program, and it exits fine when reading from a file but when keyboard input is supplied the program won't exit if the user just hits enter (thus submitting a null value).
stack1.cc = 0;
if(stack1.aa[stack1.cc].length() > 80)
cerr "Too long";
cerr "Bad input";
// end of program
Any idea to why it won't exit through keyboard input?
int main(int argc, char *argv)
string temp, holder;
lncount = 0;
cerr << "Bad input on line " << lncount;
if(temp == '>') // push
temp = temp.substr(1, temp.length()); // remove '>'
temp += "\n";
cerr << "No memory for allocating queue element, current queue size is " << myQueue.queueElements << ".\n";
else if(temp == '<') // pop
holder = myQueue.pop();
cerr << "Empty queue.\n";
cout << holder;
else // bad input
cerr << "Bad input at line " << lncount << ".\n";
// reset error status
myQueue.errExists = false;