標題:
switch 判斷式 (三)
[打印本頁]
作者:
tonyh
時間:
2013-10-19 17:52
標題:
switch 判斷式 (三)
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char answer;
cout<<"<小米的腦殘問答>"<<endl;
cout<<"請問豬有幾隻腳? (A)一隻 (B)兩隻 (C)三隻 (D)四隻"<<endl;
cout<<"請作答: ";
cin>>answer;
switch(answer)
{
case 'a':
case 'A':
cout<<"用跳的嗎?";
break;
case 'b':
case 'B':
cout<<"沒吃過豬肉也看過豬走路!";
break;
case 'c':
case 'C':
cout<<"你是豬啊?";
break;
case 'd':
case 'D':
cout<<"答對了!";
break;
default:
cout<<"輸入錯誤!";
}
cout<<endl;
system("pause");
return 0;
}
複製代碼
作者:
張峻瑋
時間:
2013-10-19 17:53
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char answer;
cout<<"<超腦殘問答>"<<endl;
cout<<"雞有幾顆頭?(a)1顆(b)2顆(c)3顆(d)無限多顆"<<endl;
cout<<"請作答!!!";
cin>>answer;
switch(answer)
{
case 'a':
case 'A':
cout<<"答對了!!好厲害!";
break;
case 'b':
case 'B':
cout<<"智商-10000000000";
break;
case 'c':
case 'C':
cout<<"恐怖啊!";
break;
case 'd':
case 'D':
cout<<"慘了!雞變成了怪物";
break;
default:
cout<<"輸入錯誤!";
}
cout<<endl;
system("pause");
return 0;
}
複製代碼
作者:
周雍程
時間:
2013-10-19 17:53
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
char answer;
cout <<"<???>"<<endl;
cout <<"你晚上吃什麼? (a)垃圾 (b)鋼鐵 (c)我 (d)沒有吃東西"<<endl;
cout <<"請作答:";
cin >> answer;
switch(answer)
{
case 'a':
case 'A':
cout <<"你是流浪漢嗎?"<<endl;
break ;
case 'b':
case 'B':
cout <<"嗨!鋼鐵人"<<endl;
break ;
case 'c':
case 'C':
cout <<"回家吃自己!"<<endl;
break ;
case 'd':
case 'D':
cout <<"你失憶了,走!去看醫生."<<endl;
break ;
default:
cout <<"不會數數嗎,只有4而已!!"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
劉得旗
時間:
2013-10-19 17:54
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char answer;
cout<<"<腦殘問答>"<<endl;
cout<<"請問你有幾隻手? (a)1隻 (b)5隻 (c)2隻 (d)9隻"<<endl;
cin>>answer;
switch(answer)
{
case 'a':
case 'A':
cout<<"笨蛋";
break;
case 'b':
cout<<"笨蛋";
break;
case 'c':
cout<<"答對了!阿不就好棒棒?";
break;
case 'd':
cout<<"笨蛋";
break;
default:
cout<<"Error";
}
system("pause");
return 0;
}
複製代碼
作者:
張彥承
時間:
2013-10-19 17:54
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char answer;
cout<<"<Smosh's stupid question>"<<endl;
cout<<"2個半小時是幾分鐘:(a)120分(b)60分(c)55分(d)59分"<< endl;
cout<<"Please answer:"<<endl;
cin>>answer;
switch(answer)
{
case 'a':
case 'A':
cout<<"wrong answer!"<<endl;
break;
case 'b':
case 'B'
cout<<"Bingo!"<<endl;
break;
case 'c':
case 'C':
cout<<"wrong answer!"<<endl;
break;
case 'd':
case 'D' :
cout<<"wrong answer!"<<endl;
break;
default:
cout<<"you really are a dickhole!"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
施伯叡
時間:
2013-10-19 17:54
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char ans;
cout << "超智障問答" <<endl;
cout << "請問水是甚麼顏色?" ;
cout << "(a)黃色 (b)紅色 (c)透明 (d)紫色" << endl;
cout << "請作答:" ;
cin >> ans ;
switch(ans)
{
case 'a':
cout<<"去測一下你的智商吧!";
break;
case 'b':
cout<<"犯案現場請勿靠近!";
break;
case 'c':
cout<<"你的智商180!";
break;
case 'd':
cout<<"你喝水溝的水嗎?";
break;
default:
cout<<"別亂打!";
}
cout<<endl;
system("pause");
return 0;
}
複製代碼
作者:
張郁偵
時間:
2013-10-19 17:55
#include <iostream>
#include <cstdlib>
using namespace std;
int main ()
{
char answer;
cout<<" 一, 選擇題"<<endl;
cout<<"請問豬的運動型態為何? (a)飛(b)爬(c)走(d)以上全部正確"<<endl;
cin >>answer;
switch(answer)
{
case 'a':
cout<<"你有看過豬長翅膀的嗎?"<<endl;
break;
case 'b':
cout<<"豬不是昆蟲!"<<endl;
break;
case 'c':
cout<<"賓果!!"<<endl;
break;
case 'd':
cout<<"瞎!"<<endl;
break;
default:
cout<<"輸入錯誤"<<endl;
}
system ("pause");
return 0;
}
複製代碼
作者:
張郁庭
時間:
2013-10-19 18:02
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
char ans;
cout << "小美教你學成語" <<endl;
cout << "請問天空是甚麼顏色?" ;
cout << "(a)黃色 (b)黑色 (c)藍色 (d)白色" << endl;
cout << "請作答:" ;
cin >> ans ;
switch(ans)
{
case 'a':
cout<<"現在應該是日出或日落吧!";
break;
case 'b':
cout<<"現在一定是<烏雲密布>!";
break;
case 'c':
cout<<"現在應該是<晴天萬里>!";
break;
case 'd':
cout<<"現在應該是布滿白雲!";
break;
default:
cout<<"答錯了!";
}
cout<<endl;
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2