Hello I am newbie to C++ and I am testing my first loop using a switch statement. I want the loop to run nonstop until the user quits the program.
#include <iostream>
using namespace std;
int main()
{
char answ;
cout << "Yes or No(y/n)" << endl;
cin >> answ;
switch(answ)
{
case1:
do
{
cout << "Test" << endl;
}
while((answ == 'y') || (answ =='Y'));
break;
case0:
do
{
cout << "OK" << endl;
}
while((answ =='n') || (answ == 'N'));
break;
}
system("PAUSE");
return 0;
}
The code compiles and runs but when I enter "Yes" it doesn't print out "Test" like I want it to. Neither when I enter "No". Can anyone help?