- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int m;int n;
- cout<<"輸入m的值:\r\n";
- cin>>m;
- cout<<"輸入n的值:\r\n";
- cin>>n;
-
- if(m!=0 && n!=0)
- {
- cout<<"m+n="<<m+n<<endl;
- cout<<"m-n="<<m-n<<endl;
- cout<<"m*n="<<m*n<<endl;
- cout<<"m/n="<<m/n<<endl;
- cout<<"m%n="<<m%n<<endl;
- }
- else
- {
- cout<<"x與y值不能為0,重新輸入!!\r\n";
- }
-
-
-
-
-
- system("pause");
- return 0;
- }
複製代碼 |