1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#include <iostream>// 输出流库 using namespace std;//使用标准命名空间 //课程:3.4 运算符 赋值 int main() { int a = 10; // = a = 100; cout << "= \ta =" << a << endl; // += a = 10; a += 2;//a = a + 2; cout << "+= \ta =" << a << endl; // -= a = 10; a -= 2;//a = a - 2; cout << "-= \ta =" << a << endl; // *= a = 10; a *= 2;//a = a * 2; cout << "*= \ta =" << a << endl; // /= a = 10; a /= 2;//a = a / 2; cout << "/= \ta =" << a << endl; // %= a = 10; a %= 2;//a = a % 2; cout << "%= \ta =" << a << endl; system("pause");// 控制台暂停,等待下一步操作 return 0;// 结束返回值:0 } |
03.4 C++运算符赋值运算
未经允许不得转载:Ai分享 » 03.4 C++运算符赋值运算