Was coding on linux(centos4.8 Server edition) and constantly getting error Inspite of the right code. The code displayed below is not copied and pasted from anywhere coz I am typing it hence no chance of entering junk characters. The Code is as follows: -
#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
KINDLY NOTE: - I HAD TO TYPE "s (Double Quotes) Button twice to get it printed on screen everytime while enclosing string characters.. I understand that error has got to do with parsing miscalculation hence its giving the stray character and ending it in wrong token, so i viewed the HEXCODE format of the same Source Code and deleted on the junk character C2(hexadecimal) and after removing the same all the errors regarding: -
error: stray '\194' in program
vanished but rest were still remaining.
My GCC compiler version is:
g++ -v(command)
... skipping the option details
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-11)