- #include<cstdlib>
- #include<iostream>
- using namespace std;
- int main()
- {
- int x,y;
-
- cout<<"請輸入x的值"<<endl;
- cin>>x;
- cout<<"請輸入y的值"<<endl;
- cin>>y;
- if((x!=0)&&(y!=0))
- {
- cout<<"當x的質為:"<<x;cout<<"當y的質為:"<<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;
- cout<<"x%y="<<x%y<<endl;
-
- }
- else
- {
- cout<<"請重新輸入"<<endl;
-
- }
-
-
-
-
-
-
-
-
-
-
- system("pause");
- return 0;
- }
複製代碼 |