返回列表 發帖
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     int a;
  7.     int b;
  8.    
  9.     cout <<"請輸入 :";
  10.     cin>> a;
  11.     cout <<"請輸入 b:";
  12.     cin>> b;
  13.    
  14.     cout<<"a=="<<a<<endl;
  15.     cout<<"b=="<<b<<endl;
  16.    
  17.     if(a>b)
  18.     {
  19.            cout<<"a大於b"<<endl;

  20.            }
  21.      else if(a<b)
  22.      {
  23.           cout<<"a等於b"<<endl; }
  24.          
  25.           system("pause");
  26.           return 0;
  27.           }
複製代碼

TOP

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     int a;
  7.     int b;
  8.    
  9.     cout <<"請輸入 a:";
  10.     cin>> a;
  11.     cout <<"請輸入 b:";
  12.     cin>> b;
  13.    
  14.     cout<<"a=="<<a<<endl;
  15.     cout<<"b=="<<b<<endl;
  16.    
  17.     if(a>b)
  18.     {
  19.            cout<<"a大於b"<<endl;

  20.            }
  21.      else if(a<b)
  22.      {
  23.           cout<<"a等於b"<<endl; }
  24.          
  25.           system("pause");
  26.           return 0;
  27.           }
  28.      
複製代碼

TOP

  1.             #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    
  6.     int score;
  7.     int level;
  8.     cout<<"請輸入您的分數:";
  9.     cin>>score;
  10.     cout<<"score=="<<score<<endl;
  11.     level=score/10;
  12.    
  13.     cout<<"您的評等是:";
  14.     switch(level)
  15.     {
  16.                
  17.      case 10:
  18.      case 9:     
  19.      cout<<"A"<<endl;
  20.      break;
  21.      case 8:   
  22.      cout<<"B"<<endl;

  23.      break;
  24.      case 7:
  25.      cout<<"C"<<endl;
  26.      break;                    
  27.       case 6:   
  28.       cout<<"D"<<endl;
  29.       break;
  30.       default:   
  31.       cout<<"E"<<endl;
  32.       break;   
  33.      }            
  34.                  
  35.     system("pause");
  36.     return 0;

  37. }
複製代碼

TOP

返回列表