- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- //int x=23; //宣告一個整數變數,變數的名稱是x,變數的值是23
- //int y=7;
- int x=23,y=7;
- cout<<"當x的值為"<<x<<", y的值為"<<y<<"時..."<<endl;
- cout<<"x+y="<<x+y<<endl; //30
- cout<<"x-y="<<x-y<<endl; //16
- cout<<"x*y="<<x*y<<endl; //161
- cout<<"x/y="<<x/y<<endl; //3
- cout<<"x%y="<<x%y<<endl; //2
- system("pause");
- return 0;
- }
複製代碼 |