Basically, I'm trying to learn C++, and I'm new at this. I know I can continue my program as it is, but I would rather know how to fix this problem now, for future issues.
So the switch statement works when I enter the single int values, but if I put 1 2 3 with spaces, the program opens all the cases. Also when I enter letters it loops non-stop. AND 312413431 43 also loops the program.
Your while loop at line 14 checks tryagain, but tryagain is only modified at line 39 (choice not 1,2 or 3). If you enter "1 2 3" you have three numbers in the input buffer. The first time through the loop, the cin at line 25 reads the "1". Since tryagain is still 'n', the loop at line 14 continues for a second iteration which reads the "2" from the input buffer. The loop continues for a third iteration, reading the "3" from the input buffer.