#include <iostream>
#include <string>
using namespace std;
int main()
{
//前置递增和后置递增区别
//前置递增 先让变量+1 然后进行表达式运算
int a1 = 10;
int b1 = ++a1 * 10;
cout << a1 << endl;
cout << b1 << endl;
//后置递增 先进行表达式运算,然后再让变量+1
int a2 = 10;
int b2 = a2++ * 10;
cout << a2 << endl;
cout << b2 << endl;
system("pause");
return 0;
}
网友评论