标签:cpp 提前 bre name 系统 family 函数 用户 out
用户输入功能选择。依据给出的答复,用switch多分支完毕相应的功能:
#include <iostream>
using namespace std;
int main()
{
char cChioce;
void cTaiYuan();
void cJinCheng();
void cDaTong();
do
{
cout<<""<<endl;
cout<<"五一到了,请选择一个地区做为作为旅游的地方!"<<endl<<endl;
cout<<"*1. 太原市"<<endl;
cout<<"*2. 晋城市"<<endl;
cout<<"*3. 大同市"<<endl;
cout<<"*0. 退出"<<endl;
cout<<"*请选择(0-3):";
cin>>cChioce;
if (cChioce==‘1‘) // 我竟然将==写成=
cTaiYuan();
else if (cChioce==‘2‘)
cJinCheng();
else if (cChioce==‘3‘)
cDaTong();
else if (cChioce==‘0‘)
break;
else
{
cout<<"\007选择错误。"<<endl<<endl;
continue;
}
cout<<"恭喜你选择了一个地区做为你的五一旅游的地方!"<<endl<<endl<<endl;
}while(1);
return 0;
};
void cTaiYuan()
{
cout<<"你选择的地方是太原市!"<<endl;
}
void cJinCheng()
{
cout<<"你选择的地方是晋城市!"<<endl;
}
void cDaTong()
{
cout<<"你选择的地方是大同市!
"<<endl;
}
标签:cpp 提前 bre name 系统 family 函数 用户 out
原文地址:http://www.cnblogs.com/llguanli/p/6788781.html