返回列表 發帖

五則運算(二)

  1. #include<iostream> // <-基本輸出輸入的函式庫 Input Output   cin 輸入 cout 輸出  
  2. #include<cstdlib> //主要的函式庫 Library
  3. using namespace std;
  4. int main()
  5. {
  6.     int x; int y;
  7.     cout << "兩數的五則運算" <<endl;
  8.     cout << "請輸入x的值:" <<endl;
  9.     cin >> x;
  10.     cout << "請輸入y的值:" <<endl;
  11.     cin >> y;
  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. }
複製代碼

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    int x;int y;
    cout<<"兩數的五則運算"<<endl;
    cout<<"請輸入x的值:"<<endl;
     cin>>x ;
    cout<<"請輸入y的值:"<<endl;
    cin>>y;
    cout <<"x+y="<<x+y<<endl;
    cout <<"x-y="<<x-y<<endl;
    cout <<"x*y="<<x*y<<endl;
    cout <<"x/y="<<x/y<<endl;
    cout <<"x%y="<<x%y<<endl;
   
    system("pause");
    return 0;
}

TOP

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

  4. int main()
  5. {
  6.     int m;int n;
  7.     cout<<"輸入m的值:\r\n";
  8.     cin>>m;
  9.     cout<<"輸入n的值:\r\n";
  10.     cin>>n;
  11.    
  12.     cout<<"m+n="<<m+n<<endl;
  13.     cout<<"m-n="<<m-n<<endl;
  14.     cout<<"m*n="<<m*n<<endl;
  15.     cout<<"m/n="<<m/n<<endl;
  16.     cout<<"m%n="<<m%n<<endl;
  17.    
  18.    
  19.     system("pause");
  20.     return 0;   
  21. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     cout<<"兩數的五則運算"<<endl;
  7.     int x;
  8.     int y;
  9.     cout<<"請輸入x的值"<<endl;
  10.     cin>>x;
  11.     cout<<"請輸入y的值"<<endl;
  12.     cin>>y;
  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.     cout<<"x%y="<<x%y<<endl;
  18.     system("pause");
  19.     return 0;
  20. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x; int y;
  7.     cout<<"x"<<endl;
  8.     cin>>x;
  9.     cout<<"y"<<endl;
  10.     cin>>y;
  11.    
  12.    
  13.    
  14.    
  15.     cout<<"x+y="<<x+y;
  16.     cout<<"x-y="<<x-y;
  17.     cout<<"x*y="<<x*y;
  18.     cout<<"x/y="<<x/y;
  19.     cout<<"x%y="<<x%y;
  20.    
  21.    
  22.    
  23.    
  24.      system("pause");
  25.       return 0;   
  26.    
  27.    
  28. }
複製代碼

TOP

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

  4. int main()
  5. {
  6.     int m;int n;
  7.     cout<<"輸入m的值:\r\n";
  8.     cin>>m;
  9.     cout<<"輸入n的值:\r\n";
  10.     cin>>n;
  11.    
  12.     cout<<"m+n="<<m+n<<endl;
  13.     cout<<"m-n="<<m-n<<endl;
  14.     cout<<"m*n="<<m*n<<endl;
  15.     cout<<"m/n="<<m/n<<endl;
  16.     cout<<"m%n="<<m%n<<endl;
  17.    
  18.    
  19.     system("pause");
  20.     return 0;   
  21. }
複製代碼

TOP

返回列表