在 linux(centos4.8 服务器版)上编码,尽管代码正确,但不断出错。下面显示的代码不是从任何地方复制和粘贴的,因为我正在输入它,因此没有机会输入垃圾字符。守则如下: -
#include <iostream> // L:1
using namespace std; // L:2
int main() // L:3
{
int i; // L:4
cout << "Enter the no: - "; // L:5
cin >> i; // L:6
cout << "The number entered is: - " << i; // L:7
return 0; // L:8
}
It gives me error as follows: -
line 5: error: stray '\194' in program
line 5: error: stray '\168' in program
line 5: error: `Enter' was not declared in this scope
line 5: error: expected `;' before "the"
line 5: error: stray '\' in program
line 5: error: stray '\194' in program
line 5: error: stray '\168' in program
line 7: error: `The' was not declared in this scope
line 7: error: expected `;' before "number"
line 7: error: stray '\194' in program
line 7: error: stray '\168' in program
请注意:-我必须键入“s(双引号)按钮两次才能在每次包含字符串字符时将其打印在屏幕上。我知道错误与解析错误有关,因此它给出了杂散字符并以错误的标记,所以我查看了相同源代码的 HEXCODE 格式并删除了垃圾字符 C2(十六进制),并在删除相同的所有错误之后: -
error: stray '\194' in program
消失了,但仍然存在。
我的 GCC 编译器版本是:
g++ -v(command)
... skipping the option details
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-11)