主页
C++
C++ 算术运算符
demo_oper_arit_all
运行 ❯
×
更改方向
保存代码
更改主题
#include
using namespace std; int main() { int x = 10; int y = 3; cout << (x + y) << "\n"; // 13 cout << (x - y) << "\n"; // 7 cout << (x * y) << "\n"; // 30 cout << (x / y) << "\n"; // 3 (integer division!) cout << (x % y) << "\n"; // 1 int z = 5; ++z; cout << z << "\n"; // 6 --z; cout << z << "\n"; // 5 return 0; }
13
7
30
3
1
6
5