標題:
switch 判斷
[打印本頁]
作者:
游東祥
時間:
2013-8-14 11:49
標題:
switch 判斷
#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;
}
複製代碼
作者:
林以諾
時間:
2013-8-14 11:55
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score=0;
int level=0;
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;
}
複製代碼
作者:
薛景謙
時間:
2013-8-14 11:56
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout << "請輸入您的分數:";
cin >> score;
level = score / 10;
switch(level)
{
case 10:
cout << "s" << endl;
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 << "f"<< endl;
break;
}
system("pause");
return 0;
}
複製代碼
作者:
黃崇維
時間:
2013-8-14 11:56
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score = 0;
int level = 0;
cout<<"請輸入你的分數: ";
cin>>score;
level=score/10;
switch(level)
{
case 10:
case 9:
cout<<"得 A+"<<endl;
break;
case 8:
cout<<"得 A"<<endl;
break;
case 7:
cout<<"得 A-"<<endl;
break;
case 6:
cout<<"得 B+"<<endl;
break;
default:
cout<<"得 F(不及格)"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
徐義翔
時間:
2013-8-14 11:57
#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 << "S" <<endl;
break;
case 8:
cout << "A" <<endl;
break;
case 7:
cout << "B" <<endl;
break;
case 6:
cout << "C" <<endl;
break;
case 5:
cout << "D" <<endl;
break;
case 4:
cout << "E" <<endl;
break;
default:
cout << "不及格" << endl;
break;
system("pause");
return 0;
}
複製代碼
作者:
施伯叡
時間:
2013-8-14 11:58
#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;
}
system("pause");
return 0;
}
複製代碼
作者:
柯璟廷
時間:
2013-8-14 11:59
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout<<"level:";
cin >>score;
level=score/10;
switch(level)
{
case10:
case9:
cout<<"a"<<endl;
break;
case8:
cout<<"b"<<endl;
break;
case7:
cout<<"c"<<endl;
break;
case6:
cout<<"d"<<endl;
break;
default:
cout<<"得e(不及格)"<< endl
system("pause");
return 0;
}
複製代碼
作者:
蘇昱安
時間:
2013-8-14 12:01
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int score=0;
int level=0;
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;
}
system("pause");
return 0;
}
複製代碼
作者:
李恆
時間:
2013-8-14 12:01
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score;
int level;
cout<<"請輸入你的分數:";
cin>>score;
level=score/10
switch(level)
{
case10:
case9:
cout<<" a "<<endl;
break
case8:
cout<<" b " <<endl;
break
case7:
cout<< " c " <<endl;
break
case6:
cout<< " d " <<endl;
break
default:
cout<< " e " <<endl;
system("pause");
return 0;
}
複製代碼
作者:
蔡凱益
時間:
2013-8-14 12:02
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score=0;
int level=0;
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;
case 5:
default:
cout << "E" << endl;
break;
}
system("pause");
return 0;
複製代碼
作者:
吳宗桓
時間:
2013-8-14 12:04
#include <iostream> //引入輸出輸入指令
#include <cstdlib> //引入c的語言 的標準函式
using namespace std; //用標準函式庫命名空間
int main() //程式從"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;
}
system("pause");
return 0;
}
複製代碼
作者:
張郁偵
時間:
2013-8-14 12: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;
}
system("pause");
return 0;
}
複製代碼
作者:
張郁庭
時間:
2013-8-14 12:04
#include<iostream>
#include <cstdlib>
using namespace std;
int main()
{
//switch 迴圈
int score=0;
int level=0;
cout<<"請輸入您的分數 :";
cin>>score;
level=score/10;
swich(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;
}
system("pause");
return0;
複製代碼
作者:
張彥承
時間:
2013-8-14 12:05
#include <iostream>
#include <cstdlib>
using namespace std;
int main ()
{
int=;
int=;
cout<<"enter your score:";
cin>>score;
level=score/10
switch(level)
{
case 10:
case 9:
cout<<"get a"<<endl;
break;
case 8:
cout<<"get b"<<endl;
break;
case 7:
cout<<"get c"<<endl;
break;
case 6:
cout<<"get d"<<endl;
break;
defult:
cout<<"get e"<<endl;
}
system("pause");
return0;
}
複製代碼
作者:
周雍程
時間:
2013-8-14 12:05
#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;
}
複製代碼
作者:
陳寧莉
時間:
2013-8-14 12:05
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; //告訴程式執行正確
}
複製代碼
作者:
張峻瑋
時間:
2013-8-14 12:05
#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;
}
system("pause") ;
return 0 ;
}
複製代碼
作者:
陳國蘢
時間:
2013-8-14 12:06
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int score=10;
int level=1;
cout<<"100:";
cin>>score;
level=score/10;
switch(level)
{
case10:
case9:
cout<<"a"<<endl;
break;
case8:
cout<<"b"<<endl;
break;
case7:
cout<<"c"<<endl;
break;
case6:
cout<<"d"<<endl;
break;
default:
cout<<"e"<<endl;
break;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2