与下面C++输出效果不一致的代码是( )。
int i; for (i = 0; i < 10; i++) cout << i;
- A. 1 int i = 0; 2 while (i < 10){ 3 cout << i; 4 i += 1; 5 }
- B. 1 int i = 0; 2 while (i < 10){ 3 i += 1; 4 cout << i; 5 }
- C. 1 int i = 0; 2 while (true){ 3 cout << i; 4 i += 1; 5 if (i >= 10) 6 break; 7 }
- D. 1 int i = 0; 2 while (true){ 3 if (i >= 10) 4 break; 5 cout << i; 6 i += 1; 7 }
正确答案:B