【发布时间】:2012-06-01 22:50:25
【问题描述】:
我真的无法理解后缀。我知道它首先使用标识符,然后增加或减少,首先显示i,然后是++。但是现在我觉得我错了,还是不明白。
#include <iostream>
using namespace std;
int main()
{
int i = 0;
cout << i << i++ << i;
cout << "\n\n\nPress Enter to close the window . . . ";
cin.clear();
cin.sync();
cin.get();
return 0;
}
输出:
101
Press Enter to close the window . . .
第一个i 在读取增量之前被更改。为什么?
我期待
001
Press Enter to close the window . . .
谁能解释一下。
【问题讨论】:
-
在接受答案之前,您是否真的阅读了标记副本中的任何答案?因为你接受的答案显然是错误的。
标签: c++