返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {  
  6.       // + - * / %
  7.       int x;
  8.       int y;
  9.       x = 100;     
  10.       y = 1;
  11.       cout <<" x現在是 "<<" y現在是 "<< x <<endl;
  12.       cout <<"x + y ="<< x + y << endl;
  13.       cout <<"x - y ="<< x - y << endl;
  14.       cout <<"x * y ="<< x * y << endl;
  15.       cout <<"x / y ="<< x / y << endl;
  16.       cout <<"x % y ="<< x % y << endl;
  17.       system("pause");
  18.       return 0;   
  19.    
  20. }
複製代碼

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.       cout<<" a= "<< a << endl;
  14.       cout<<" b= "<< b << endl;
  15.       if ( a > b )
  16.     {
  17.       cout <<" a 大於 b "<< endl;
  18.     }
  19.       if ( a < b )
  20.     {
  21.       cout <<" a 小於 b "<< endl;  
  22.     }                 
  23.       if  ( a == b )
  24.     {
  25.        cout <<" a 等於 b "<< endl;   
  26.     }         
  27.       system("pause");
  28.       return 0;
  29. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {  
  6.       for(int i = 1 ;i < 10 ;  i++)
  7.       {
  8.           cout<<"第"<<i<<"名"<<endl;   
  9.       }   
  10.       system ("pause");
  11.       return 0;
  12. }
複製代碼

TOP

返回列表