/*
02.* Copyright (c) 2012, 烟台大学计算机学院
03.* All rights reserved.
04.* 作 者:徐汉玉
05.* 完成日期:2012 年 11 月 1日
06.* 版 本 号:v1.0
07.* 输入描述:无
08.* 问题描述:wan shu
09.* 程序输出:求和结果
10.* 问题分析:(用for语句来完成任务和用sum表示,初始值设置为0;加数用i表示,每次循环sum=sum+i,和i=i+2,算出结果
11.* 算法设计:略
*/ #include< iostream>
using namespace std;
int main()
{
char cChioce;
do
{
cout<<"* 1.吃饭"<<endl;
cout<<"* 2.睡觉"<<endl;
cout<<"* 3.打豆豆"<<endl;
cout<<"* 0.退出"<<endl;
cout<<"* 请输入(0-3):";
cin>>cChioce;
if(cChioce=='1')
cout<<"我吃吃吃吃。。。。。。。"<<endl;
else if (cChioce=='2')
cout<<"我睡睡睡。。。。。。。。"<<endl;
else if(cChioce=='3')
cout<<"我打打打。。。。。。"<<endl;
else if(cChioce=='0')
break;
else
{
cout<<"\007选择错误!"<<endl<<endl;
continue;
}
cout<<"恭喜你完成一项工作"<<endl<<endl;
}while(1);
return 0;
}
运行结果: