標題:
switch 判斷式 : 分數評等
[打印本頁]
作者:
游東祥
時間:
2014-1-23 10:58
標題:
switch 判斷式 : 分數評等
[attach]820[/attach][attach]819[/attach][attach]818[/attach][attach]817[/attach]
1. 讓使用者輸入分數(0~100)
2. 顯示評等
A : 90~100
B : 80~89
C : 70~79
D : 60~69
E : 0~60
作者:
劉得恩
時間:
2014-1-23 10:59
本帖最後由 劉得恩 於 2014-1-23 11:05 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score,level;
cout<<"請輸入您的分數:";
cin>>score;
level=score/10;
cout<<"您的評等是:";
switch(level)
{
case 10:
case 9:
cout<<"A"<<endl;
break;
case 8:
cout<<"B\n";
break;
case 7:
cout<<"C\n";
break;
case 6:
cout<<"D\n";
break;
default:
cout<<"E\n";
break;
}
system("PAUSE");
return 0;
}
複製代碼
作者:
陳婉平
時間:
2014-1-23 11:00
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout <<"請輸入您的分數:";
cin >>score;
level = score / 10;
cout <<"您的評等是:";
switch (level)
{
case 10:
case 9:
cout <<"A" <<endl;
break;
case 8:
cout <<"B" <<endl;
case 7:
cout <<"C" <<endl;
break;
case 6:
cout <<"D" <<endl;
break;
default:
cout <<"E" <<endl;
break;
}
system ("pause");
return 0;
}
複製代碼
作者:
黃詠軒
時間:
2014-1-23 11:01
本帖最後由 黃詠軒 於 2014-1-23 11:06 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score
int level
cout << "請輸入您的分數:";
cin >> score;
level = score / 10;
cout << "score=" << score << endl;
cout << "level=" << level << endl;
cout << "您的評等是:";
switch(level)
{
case 10:
case 9:
cout <<"A"<<endl;
break;
case 8:
cout <<"B"<<endl;
break;
case 7:
cout <<"C"<<endl;
break;
case 6:
cout <<"D"<<endl;
break;
default:
cout <<"E"<<endl;
break;
}
system("pause");
return 0;
}
複製代碼
作者:
林宇翔
時間:
2014-1-23 11:01
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout <<"請輸入你的分數,否則砍頭:";
cin >> score;
cout <<"score=" << score <<endl;
level = score / 10;
switch (level)
{
case 10:
case 9:
cout <<"A"<<endl;
break;
case 8:
cout <<"B"<<endl;
break;
case 7:
cout <<"C"<<endl;
break;
default:
cout <<"D"<<endl;
break;
}
system("pause");
return 0;
}
複製代碼
作者:
陳均
時間:
2014-1-23 11:02
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout <<"輸入您的分數:";
cin >>score;
level=score/10;
cout<<"您的評等為:";
switch(level)
{
case 10:
case 9:
cout<<"A"<<endl;
break;
case 8:
cout<<"B"<<endl;
break;
case 7:
cout<<"C"<<endl;
break;
case 6:
cout<<"D"<<endl;
break;
default:
cout<<"E"<<endl;
break;
}
system ("pause");
return 0;
}
複製代碼
作者:
郭品君
時間:
2014-1-23 11:04
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout<<"請輸入您的分數:";
cin>>score;
level=score/10;
switch(level)
{
case 10:
case 9:
cout<<"a"<<endl;
break;
case 8:
cout<<"b"<<endl;
break;
case 7:
cout<<"c"<<endl;
break;
case 6:
cout<<"d"<<endl;
break;
default:
cout<<"e"<<endl;
break;
}
system("pause");
return 0;
}
複製代碼
作者:
李允軒
時間:
2014-1-23 11:04
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout << "請輸入您的成績";
cin >> score;
level = score/10;
cout << "您的評等是:";
switch(level)
{
case 10:
case 9:
cout << "A" << endl;
break;
case 8:
cout << "b" << endl;
break;
case 7:
cout << "c" << endl;
break;
case 6:
cout << "d" << endl;
break;
default:
cout << "e" << endl;
break;
}
system ("pause");
return 0;
}
複製代碼
作者:
劉怡修
時間:
2014-1-23 11:08
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout <<"請輸入你的分數 , 否則沒命:";
cin >> score;
cout <<"score" << score <<endl;
level = score / 10;
switch (level)
{
case 10:
case 9:
cout <<"A"<<endl;
break;
case 8:
cout <<"B"<<endl;
break;
case 7:
cout <<"C"<<endl;
break;
case 6:
cout <<"D"<<endl;
break;
default:
cout <<"E"<<endl;
break;
}
system("pause");
return 0;
}
複製代碼
作者:
任冠宇
時間:
2014-1-23 11:09
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout<<"請輸入您的分數:";
cin>>score;
level=score/ 10;
cout<<"您的評等是:";
switch(level)
{
case 10:
case 9:
cout<<"A"<<endl;
break;
case 8:
cout<<"B"<<endl;
break;
case 7:
cout<<"c"<<endl;
break;
case 6:
cout<<"D"<<endl;
break;
default:
cout<<"E"<<endl;
break;
}
system("pause");
return 0;
}
複製代碼
作者:
劉芝均
時間:
2014-1-23 11:16
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout <<"請輸入您的分數:";
cin >> score;
level=score/10;
switch(level)
{
case 10 :
case 9:
cout <<"A" <<endl;
break;
case 8:
cout <<"B" <<endl;
break;
case 7:
cout <<"C"<<endl;
break;
case 6:
cout <<"D"<<endl;
break;
default:
cout <<"E" <<endl;
break;
}
system ("pause");
return 0;
}
複製代碼
作者:
黃國清
時間:
2014-1-23 12:06
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout<<"請輸入您的分數:";
cin>>score;
level=score / 10;
cout<<"您的評等是:";
switch(level)
{
case 10:
case 9:
cout<<"A"<<endl;
break;
case 8:
cout<<"B"<<endl;
break;
case 7:
cout<<"C"<<endl;
break;
case 6:
cout<<"D"<<endl;
break;
default:
cout<<"E"<<endl;
break;
}
if(level<6)
{
cout<<"哈哈你好爛"<<endl;
}
if(level==10)
{
cout<<"你是作弊嗎"<<endl;
}
if(level==9)
{
cout<<"你是作弊嗎"<<endl;
}
if(level==0)
{
cout<<"你還是人嗎,哪有人笨成這樣"<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2