返回列表 發帖
  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.     if(m!=0 && n!=0)
  13.     {
  14.     cout<<"m+n="<<m+n<<endl;
  15.     cout<<"m-n="<<m-n<<endl;
  16.     cout<<"m*n="<<m*n<<endl;
  17.     cout<<"m/n="<<m/n<<endl;
  18.     cout<<"m%n="<<m%n<<endl;
  19.     }
  20.     else
  21.     {
  22.    cout<<"x與y值不能為0,重新輸入!!\r\n";   
  23.     }
  24.    
  25.    
  26.    
  27.    
  28.    
  29.     system("pause");
  30.     return 0;   
  31. }
複製代碼

TOP

返回列表