multiple instances of cin
Heya everyone!
I was curious about something...I've created a while loop that handles user input for two numbers...then inside the loop I have another instance where the user is entering a number to enter a switch statement...interestingly, when the user enters the number for the switch, the switch is never executed and in fact the prog makes it so you haveta enter the variable for the switch three times and when you do that...it skips the whole loop body and starts from the beginning of the loop...
Now I was wondering if it's the fact that I have another instance of cin within the while loop that's conflicting with the calls to cin in the while test expression? Any insight into this interesting predicament would help me a lot...if it helps any here's a bit of my while loop:
Code:
while (cin >> first_num >> sec_num)
{
cout << "Would you like to multiply or add the two numbers?\n"
<< "Enter 1 to multiply,"
<< "enter 2 to add: ";
int choice;
cin >> choice;
switch(choice)
Well...any help would be really cool, thanks a lot everyone-Chap