#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;
if(x!=0 && y!=0)
{
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<<"x與y不可為0,請重新輸入!"<<endl;
}
system("pause");
return 0;
} |