Newbie Loop Question.
--------------------------------------------------------------------------------
05-10-2004, 04:51 PM I'm brand new to C++ programming, this shouldn't be too difficult of a question for a real programmer. I made a calculator program and I'm not understanding the loop I managed to put in.
See... what it does it is perform all of the operations then loop back to the beginning with a "while" command. I specifically did this:
Code:
int x;
while(1)
{ <THE FOLLOWING IS ALL THE OPERATIONS>
}
See how it simply ends with a curly bracket? What I want to do is make my final command, which is:
cout << "1: Try Again \n";
cout << "2: Exit \n";
cout << ">";
...the reply "Try Again" I want to make start the loop again, while the command "Exit" I want to close the program. Unfortunatly, since the "cout" is in the loop brackets, the "cin" and all of the "If" commands have to be in the loop bracket as well, so the "Exit" command just makes it loop still. How do I make this work?