標題:
if...else if...else 判斷式
[打印本頁]
作者:
陳品肇
時間:
2019-4-11 14:30
標題:
if...else if...else 判斷式
[attach]6279[/attach]
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
cout<<"報上成績: ";
cin>>score;
if(score==100)
cout<<"滿分!"<<endl;
else if(score>=60 && score<100)
cout<<"及格了!"<<endl;
else if(score>0 && score<60)
cout<<"不及格!打屁股!"<<endl;
else if(score==0)
cout<<"鴨蛋!去吃大便吧~~"<<endl;
else
cout<<"亂來~ 斬!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
謝蓮金
時間:
2019-4-13 10:32
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a;
cout<<"請輸入你的成績: ";
cin>>a;
if(a==100)
cout<<"滿分!"<<endl;
else if(a>=60 && a<=99)
cout<<"及格!"<<endl;
else if(a>=1 && a<=59)
cout<<"不及格!"<<endl;
else if(a==0)
cout<<"0分"<<endl;
else
cout<<"輸入錯誤"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
李易展
時間:
2019-4-13 10:35
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
re:
int a;
cout<<"輸入成績:";
cin>>a;
if(a==100)
cout<<"哇,滿分耶~~~"<<endl;
else if(a>=60 && a<100)
cout<<"有及格耶,很棒"<<endl;
else if(a<60 && a>0)
cout<<"ㄜ,不及格"<<endl;
else if(a==0)
cout<<"0鴨蛋,到底有沒有讀書啊???"<<endl;
else
cout<<"輸入錯誤了"<<endl;
goto re;
system("pause");
return 0;
}
複製代碼
作者:
邱楷宸
時間:
2019-4-13 10:39
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
cout<<"成績?: ";
cin>>score;
if(score==100)
cout<<">_<!"<<endl;
else if(score>=60 && score<100)
cout<<"及格了!"<<endl;
else if(score>0 && score<60)
cout<<"不及格!去xxx!"<<endl;
else if(score==0)
cout<<"D:"<<endl;
else
cout<<"!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
洪藜芸
時間:
2019-4-13 10:41
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a;
cout<<"請輸入成績:";
cin>>a;
if(a==100)
{
cout<<"滿分!好棒棒!"<<endl;
}
else if(a>=60 && a<=99)
{
cout<<"及格......而已"<<endl;
}
else if(a<=59 && a>=1)
{
cout<<"連及格都沒有!"<<endl;
}
else if(a==0)
{
cout<<"零分......呵。"<<endl;
}
else
{
cout<<"不會輸入嗎?!"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
黃傳耀
時間:
2019-4-13 10:41
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
cout<<"請輸入分數:";
cin>>score;
if(score == 100)
{
cout<<"太棒了,考滿分"<<endl;
}
else if(score>=60 && score<100)
{
cout<<"及格,不錯呦"<<endl;
}
else if(score<60 && score>0)
{
cout<<"不及格,爛透了"<<endl;
}
else if(score == 0)
{
cout<<"居然零分,用猜的都考比你高"<<endl;
}
else
{
cout<<"輸入錯誤"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
王建葦
時間:
2019-4-20 09:28
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
cout<<"請輸入成績:";
cin>>score;
if(score>=60&&score<100)
cout<<"及格"<<endl;
else if(score<60&&score>=0)
cout<<"不及格"<<endl;
else if(score==100)
cout<<"滿分"<<endl;
else
cout<<"輸入錯誤"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
陳宇柏
時間:
2019-5-28 17:21
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
cout<<"輸入成績:";
cin>>score;
if(score==100)
cout<<"恭喜你得到了滿分!"<<endl;
else if(score>=60 && score<100 )
cout<<"恭喜你及格了!"<<endl;
else if(score==0)
cout<<"鴨蛋!吃屎吧你!"<<endl;
else
cout<<"輸入錯誤!斬!"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
陳宇柏
時間:
2019-5-28 17:36
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
cout<<"輸入成績:";
cin>>score;
if(score==100)
cout<<"恭喜你得到了滿分!"<<endl;
else if(score>=60 && score<100 )
cout<<"恭喜你及格了!"<<endl;
else if(score==0)
cout<<"鴨蛋!吃屎吧你!"<<endl;
else if(score>0 && score<60)
cout<<"不及格!打屁股!"<<endl;
else
cout<<"輸入錯誤!斬!"<<endl;
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2