#include <iostream>
using namespace std;
int main()
{
char x,y,z;
while(true){
cout<<"MAIN MENU:"<<endl;
cout<<"l:left,r:right,q:quit->";
cin>>x;
switch(x)
{
case 'q':cout<<"quitting menu..."<<endl; break;
case 'l':cout<<"LEFT MENU:"<<endl;
cout<<"select a or b:";cin>>y;
switch(y){
case 'a':cout<<"you chose 'a'"<<endl;break;
case 'b':cout<<"you chose 'b'"<<endl;break;
default :cout<<"you didn't chose a or b!"<<endl;
}
break;
case 'r':cout<<"RIGHT MENU:"<<endl;
cout<<"select c or d:";
cin>>z;
switch(z){
case 'c':cout<<"you chooe 'c'"<<endl;break;
case 'd':cout<<"you chose 'd'"<<endl; break;
default :cout<<"you didn't chose c or d!"<<endl;
}
break;
default :cout<<"you must type l or r or q!"<<endl;
}
}
}
这个程序我想在输入'q'后退出,应该加点什么 ?