標題:
switch 判斷式 (二)
[打印本頁]
作者:
tonyh
時間:
2013-3-23 15:09
標題:
switch 判斷式 (二)
利用switch敘述, 設計一有趣的急智問答.
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int answer;
cout<<"***小米的腦殘問答***"<<endl;
cout<<"請問豬有幾隻腳? (1)一隻 (2)兩隻 (3)三隻 (4)四隻"<<endl;
cout<<"請作答: ";
cin>>answer;
switch(answer)
{
case 1:
cout<<"用跳的啊?"<<endl;
break;
case 2:
cout<<"沒吃過豬也看過豬走路!"<<endl;
break;
case 3:
cout<<"你是豬啊! 笨!"<<endl;
break;
case 4:
cout<<"答對了!"<<endl;
break;
default:
cout<<"輸入錯誤!"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
劉得旗
時間:
2013-3-23 15:16
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int answer;
cout<<"智障白痴問答"<<endl;
cout<<"你有幾隻腳?(1)1隻(2)5隻(3)2隻(4)0隻"<<endl;
cout<<"請作答:"<<endl;
cin>> answer;
switch(answer)
{
case 1:
cout<<"你用跳的喔?"<<endl;
break;
case 2:
cout<<"外星人!"<<endl;
break;
case 3:
cout<<"答對"<<endl;
break;
case 4:
cout<<"去死八"<<endl;
break;
default:
cout<<"Error"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
許逸群
時間:
2013-3-23 15:21
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a;
cout<<"***<<百萬小常識>>***"<<endl;
cout<<"請問世界上年紀最大的人住在哪一個國家??"<<endl;
cout<<"(1)台灣(2)荷蘭(3)美國(4)韓國"<<endl;
cout<<"請輸入您的答案: ";
cin>>a;
switch(a)
{
case 1:
cout<<"是第二名!!"<<endl;
break;
case 2:
cout<<"答對了!!"<<endl;
break;
case 3:
cout<<"不對!!"<<endl;
break;
case 4:
cout<<"大錯特錯!!"<<endl;
break ;
default:
cout<<"輸入錯誤"<<endl;
}
system ("pause");
return 0;
}
複製代碼
作者:
林鎧言
時間:
2013-3-23 15:24
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int s;
cout<<" ********屌爆的白痴問答題********"<<endl;
cout<<"5+5+5+5=555加一撇使算式成立(不可以加在等號上)?(1)=上(2)5上(3)+上(4)555上"<<endl;
cout<<"請輸入答案:";
cin>>s;
switch(s)
{
case 1:
cout<<"都跟你講不可以加在等號上了你還猜!"<<endl;
break;
case 2:
cout<<"請問這位頭很大的人要加在哪邊啊!"<<endl;
break;
case 3:
cout<<"恭喜答對!把一撇加在+上,使+成為4!"<<endl;
break;
case 4:
cout<<"你屁啦!"<<endl;
break;
default:
cout<<"輸入錯誤"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
林以諾
時間:
2013-3-23 15:27
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int answer;
cout<<"***小屁孩的疑問***"<<endl;
cout<<"下列東西是較不重要哪個比較重要?(1)平板(2)i-pad(3)智慧型手機(4)作業?:"<<endl;
cout<<"請作答!";
cin>>answer;
switch(answer)
{
case 1:
cout<<"你笨啊!"<<endl;
break ;
case 2:
cout<<"白癡~~~~~~~!"<<endl;
break ;
case 3:
cout<<"啟智兒!"<<endl;
break ;
case 4:
cout<<"聰明!很有前途!"<<endl;
break ;
default:
cout<<"你把我當白癡耍啊!"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
黃崇維
時間:
2013-3-23 15:30
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int answer;
cout<<"***小屁孩的白痴問題!***:";
cout<<"猜一位辣妹和一位美女老師會選哪個? (1)辣妹 (2)美女 (3)都不會 (4)都會"<<endl;
cout<<"請作答:";
cin>>answer;
switch(answer)
{
case 1:
cout<<"不夠啦!笨蛋!"<<endl;
break;
case 2:
cout<<"也不要!你呆嗎?"<<endl;
break;
case 3:
cout<<"你去死吧!!"<<endl;
break;
case 4:
cout<<"屌!太好了!"<<endl;
break;
default:
cout<<"輸入錯誤!"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
劉泳鱔
時間:
2013-3-23 15:32
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int answer;
cout<<"*****神人版機智問答*****"<<endl;
cout<<"A和C誰比較低? (1)A (2)C (3)都不是 (4)一樣高"<<endl;
cout<<"你的答案是: ";
cin>>answer;
switch(answer)
{
case 1:
cout<<"你不錯!!!"<<endl;
break;
case 2:
cout<<"我知道C跟你一樣矮"<<endl;
break;
case 3:
cout<<"那我問屁阿?"<<endl;
break;
case 4:
cout<<"錯錯錯!"<<endl;
break;
default:
cout<<"輸入錯誤"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
蘇昱安
時間:
2013-3-23 15:34
#include<iostream>
#include<cstdlib>
using namespace std ;
int main()
{
int answer;
cout<<"***機制問答題***"<<endl;
cout<<"請問劉泳最喜歡的水果? (1)西瓜(2)蘋果 (3)哈密瓜 (4)都不喜歡"<<endl;
cout<<"請作答: ";
cin>>answer;
switch(answer)
{
case 1:
cout<<"很甜?"<<endl;
break;
case 2:
cout<<"太難吃!"<<endl;
break;
case 3:
cout<<"不好吃!"<<endl;
break;
case 4:
cout<<"答對了!"<<endl;
break;
default:
cout<<"輸入錯誤!"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
黃柏維
時間:
2013-3-23 15:34
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a;
cout<<"***知識問答***"<<endl;
cout<<"請問斑馬的斑紋是下列何者順序?"<<endl;
cout<<"(1)白底黑紋(2)黑底白紋(3)白底白紋(4)黑底黑紋"<<endl;
cin>> a;
switch(a)
{
case 1:
cout<<"你搞混了!"<<endl;
break;
case 2:
cout<<"恭喜你答對了!!"<<endl;
break;
case 3:
cout<<"你可能沒看過斑馬!"<<endl;
break;
case 4:
cout<<"你可能沒有走過馬路~~"<<endl;
break;
default:
cout<<"專心做答"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
郭凡瑛
時間:
2013-3-28 21:10
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int answer;
cout<<"***你不會!代表你智障~***"<<endl;
cout<<"阿拉丁有幾個哥哥? (1)1 (2)2 (3)3 (4)4"<<endl;
cout<<"請作答: ";
cin>>answer;
switch(answer)
{
case 1:
cout<<"去重念一年級吧你!!"<<endl;
break;
case 2:
cout<<"你到底幾年級啊!"<<endl;
break;
case 3:
cout<<"嘿!!算你厲害!!"<<endl;
break;
case 4:
cout<<"你智障喔!!"<<endl;
break;
default:
cout<<"輸入錯誤!"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
張瀚仁
時間:
2013-3-28 21:20
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int answer;
cout<<"智障白痴問答"<<endl;
cout<<"你有幾隻腳?(1)1隻(2)5隻(3)2隻(4)0隻"<<endl;
cout<<"請作答:"<<endl;
cin>> answer;
switch(answer)
{
case 1:
cout<<"你用跳的喔?"<<endl;
break;
case 2:
cout<<"外星人!"<<endl;
break;
case 3:
cout<<"答對"<<endl;
break;
case 4:
cout<<"去死八"<<endl;
break;
default:
cout<<"Error"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
林長逸
時間:
2013-3-29 18:47
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int answer;
cout<<"世界八大奇景問答"<<endl;
cout<<"請問何者不是八大奇景? (1)泰姬瑪哈堡(2)埃及金字塔(3)萬里長城(4)安平古堡"<<endl;
cout<<"請作答: ";
cin>>answer;
switch(answer)
{
case 1:
cout<<"亨!連這都不懂?"<<endl;
break;
case 2:
cout<<"沒知識,也要看電視阿!"<<endl;
break;
case 3:
cout<<"你是豬啊!笨!"<<endl;
break;
case 4:
cout<<"就是這個啦!!"<<endl;
break;
default:
cout<<"輸入錯誤!"<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2