返回列表 發帖

五則運算

本帖最後由 tonyh 於 2016-8-3 14:18 編輯

+  加
-   減     
*  乘
/   除
% 取餘數
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=23, y=7;
  7.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  8.     cout<<"x+y="<<x+y<<endl;
  9.     cout<<"x-y="<<x-y<<endl;
  10.     cout<<"x*y="<<x*y<<endl;
  11.     cout<<"x/y="<<x/y<<endl;
  12.     cout<<"x%y="<<x%y<<endl;
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

  1. +
  2. -
  3. *
  4. /
  5. %
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=23,y=7;
  7.    
  8.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  9.     cout<<"x+y="<<x+y<<endl;
  10.     cout<<"x-y="<<x-y<<endl;
  11.     cout<<"x*y="<<x*y<<endl;
  12.     cout<<"x/y="<<x/y<<endl;
  13.     cout<<"x%y="<<x%y<<endl;
  14.    
  15.     system("pause");
  16.     return 0;
  17. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=25,y=7;
  7.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  8.     cout<<"x+y="<<x+y<<endl;
  9.     cout<<"x-y="<<x-y<<endl;
  10.     cout<<"x*y="<<x*y<<endl;
  11.     cout<<"x/y="<<x/y<<endl;
  12.     cout<<"x%y="<<x%y<<endl;
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=23,y=7;
  7.    
  8.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  9.     cout<<"x+y="<<x+y<<endl;
  10.     cout<<"x-y="<<x-y<<endl;
  11.     cout<<"x*y="<<x*y<<endl;
  12.     cout<<"x/y="<<x/y<<endl;
  13.     cout<<"x%y="<<x%y<<endl;
  14.    
  15.     system("pause");
  16.     return 0;
  17. }     
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=23,y=7;
  7.     cout<<"當x值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  8.     cout<<"x+y="<<x+y<<endl;
  9.     cout<<"x-y="<<x-y<<endl;
  10.     cout<<"x*y="<<x*y<<endl;
  11.     cout<<"x/y="<<x/y<<endl;
  12.     cout<<"x%y="<<x%y<<endl;
  13.    
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {  
  6.     int x=23,y=7;
  7.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;  
  8.     cout<<"x+y="<<x+y<<endl;
  9.     cout<<"x-y="<<x-y<<endl;
  10.     cout<<"x*y="<<x*y<<endl;
  11.     cout<<"x/y="<<x/y<<endl;
  12.     cout<<"x%y="<<x%y<<endl;
  13.    
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include(iostream)
  2. #include(cstdlib)
  3. using namespace std;
  4. int main()
  5. {
  6.     //五則運算
  7.     //int x;
  8.     //int y;
  9.     int x=23,y=7;       //宣告兩個整數變數,並指定它們的值
  10.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  11.     cout<<"x+y="<<x+y<<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.    
  17.    
  18.     system("pause");
  19.     return 0;
複製代碼

TOP

本帖最後由 許娟慈 於 2016-8-3 14:32 編輯

回復 1# tonyh
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=23, y=7;
  7.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  8.     cout<<"x+y="<<x+y<<endl;
  9.     cout<<"x-y="<<x-y<<endl;
  10.     cout<<"x*y="<<x*y<<endl;
  11.     cout<<"x/y="<<x/y<<endl;
  12.     cout<<"x%y="<<x%y<<endl;
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.         //五則運算
  7.         //int x;
  8.         //int y;
  9.         //int x = 7;
  10.         cout<< "當X的值為"<<X<<",y的值為" <<y<< "時..." << endl;
  11.         cout<< "x + y"<< x + y << 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.         
  17.         system("(pause");
  18.         return 0;
  19. }
複製代碼

TOP

  1.   int x=23<,y=7;
  2.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  3.     cout<<"x+y="<<x+y<<endl;
  4.     cout<<"x-y="<<x-y<<endl;
  5.     cout<<"x*y="<<x*y<<endl;
  6.     cout<<"x/y="<<x/y<<endl;
  7.     cout<<"x%Y="<<x%y<<endl;
  8.    
  9.     system("pause");
  10.     return 0;
  11. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdilb>
  3. using namespace std;
  4. int main()
  5. {
  6.     //五則運算
  7.     //int x;
  8.     //int y;
  9.     int x=23,y=7
  10.    
  11.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<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.    
  18.     system("pause");
  19.     return 0;
  20. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     //五則運算
  7.     //int X;
  8.     //int Y;
  9.     int x=23,y=7;
  10.     cout<<"當x的值為"<<x<<"y的值為"<<y<<"時..."<<endl;
  11.     cout<<"x+y="<<x+y<<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.     system("pause");
  17.     return 0;
  18. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=23,y=7;   
  7.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  8.     cout<<"x+y="<<x+y<<endl;
  9.     cout<<"x-y="<<x-y<<endl;
  10.     cout<<"x*y="<<x*y<<endl;
  11.     cout<<"x/y="<<x/y<<endl;
  12.     cout<<"x%y="<<x%y<<endl;
  13.    
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     //五則運算
  7.     //int x:
  8.     //int y:
  9.     int x=20,y=7;   //宣告兩個整數變數,並指定他們的值
  10.    
  11.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<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 x=23,y=7;
  7.       
  8.       cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  9.       cout<<"x+y="<<x+y<<endl;   
  10.       cout<<"x-y="<<x-y<<endl;   
  11.       cout<<"x*y="<<x*y<<endl;      
  12.       cout<<"x/y="<<x/y<<endl;  
  13.       cout<<"x%y="<<x%y<<endl;
  14.       
  15.       system("pause");
  16.        return 0;
  17. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=23 , y=7;
  7.     cout<<"x+y="<<x+y<<endl;   
  8.     cout<<"x-y="<<x-y<<endl;
  9.     cout<<"x*y="<<x*y<<endl;
  10.     cout<<"x/y="<<x/y<<endl;
  11.     cout<<"x%y="<<x%y<<endl;
  12.    
  13.     system("pause");
  14.     return 0;

  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int x=23,y=7;
  7.    cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  8.    cout<<"x+y="<<x+y<<endl;
  9.    cout<<"x-y="<<x-y<<endl;
  10.    cout<<"x*y="<<x*y<<endl;
  11.    cout<<"x/y="<<x/y<<endl;
  12.    cout<<"x%y="<<x%y<<endl;
  13.    system("pause");
  14.    return 0;
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.     int x=23, y=7;
  6.     cout<<"當x的值為"<<x<<",y的值為"<<y<<"時....."<<endl;
  7.         cout<<"x+y="<<x+y<<endl;       
  8.         cout<<"x-y="<<x-y<<endl;       
  9.         cout<<"x*y="<<x*y<<endl;       
  10.         cout<<"x/y="<<x/y<<endl;       
  11.         cout<<"x%y="<<x%y<<endl;               
  12.         system("pause");
  13.         return 0;
  14. }
複製代碼

TOP

返回列表