没去加班,从头翻看C++ primer,想把内容看一遍,练习题做一遍。
怕有遗漏,哪怕是再简单的联系题也要做一遍。
其中一个题目,分别用for循环和while循环打印出10 到 0之间的所有的自然数。(别说我蛋疼............)
#include <iostream>
int main(int argc, char *argv[])
{
int i = 10;
while(i >= 0)
{
std::cout << i << " ";
i--;
}
std::cout << std::endl;
for(i = 10; i >= 0; i--)
{
std::cout << i << " ";
}
std::cout << std::endl;
return 0;
}
好吧!!!
真的简单到不行,可是写完一编译,他奶奶的竟然编译错误:
[Error] D:\Program\C\Program temp\1.11\main.cpp:8: error: stray '\161' in program
而且竟然检查不出来哪处错误。
好吧,求助于万能的百度:
如果VC编译器出现如此错误提示,说明你用了全角符号,潜在的可能性为:全角TAB。
咕~~(╯﹏╰)b,码代码的时候用搜狗了,用的是C_FREE编译器。
貌似在VS2010也经常用搜狗,不过也没发生过这种错误。
试试VS2010
提示错误
1>d:\program\all the angle character\all the angle character\all the angle character.cpp(12): error
C3872: “0x3000”: 此字符不允许在标识符中使用
1>d:\program\all the angle character\all the angle character\all the angle character.cpp(12): error C2039: “cout ”: 不是“std”的成员
1>d:\program\all the angle character\all the angle character\all the angle character.cpp(12): error C2065: “cout ”: 未声明的标识符
并且在cout后空白处以红色波浪线标出
智能就是好啊!!
5万+

被折叠的 条评论
为什么被折叠?



