本帖最後由 王瑞喻 於 2020-8-17 15:57 編輯
實作如下之執行畫面:
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int x,y;
- cout<<"輸入x的值: ";
- cin>>x;
- cout<<"輸入y的值: ";
- cin>>y;
- cout<<"當x等於"<<x<<",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;
- system("pause");
- return 0;
- }
複製代碼 |