dvergatal666
04-21-2003, 07:19 PM
When compiling the below:
#include <iostream.h>
int main()
{
int x = 5;
int y = 7;
cout "\n";
cout << x + y << " " << x * y;
cout "\n";
return 0;
}
I get the following error(s):
# g++ project1.cpp -o project1
project1.cpp:10:2: warning: no newline at end of file
project1.cpp: In function `int main ()':
project1.cpp:6: parse error before string constant
project1.cpp:8: parse error before string constant
I'm new to C++ and the code was provided as a (supposedly working) example in a book. Can anyone tell me what's wrong?
Note; The compiler didn't compile the code into the binary after executing the command, It did however, compile the 'Hello World' program in C++ to binary but again returned the 'no newline' error as above.
Any ideas?
#include <iostream.h>
int main()
{
int x = 5;
int y = 7;
cout "\n";
cout << x + y << " " << x * y;
cout "\n";
return 0;
}
I get the following error(s):
# g++ project1.cpp -o project1
project1.cpp:10:2: warning: no newline at end of file
project1.cpp: In function `int main ()':
project1.cpp:6: parse error before string constant
project1.cpp:8: parse error before string constant
I'm new to C++ and the code was provided as a (supposedly working) example in a book. Can anyone tell me what's wrong?
Note; The compiler didn't compile the code into the binary after executing the command, It did however, compile the 'Hello World' program in C++ to binary but again returned the 'no newline' error as above.
Any ideas?