lodebare
04-27-2002, 02:11 PM
Am trying to learn C++.followed directions in book,but keep getting a syntax error.This is the very simple Hello World program.Everything seems fine until I click on compile or run or both.Am using DevC++ from Sams teach yourself.Any suggestions?Thank You
Rhino302
04-27-2002, 07:37 PM
You'd have to post the code. Could be a problem with the book. I have a C++ book that had wrong examples. They would use "cin >" to read in, instead of have 2 ">>". That's the only thing I can think of. I haven't really done any C++. Just made one program of my own besides book examples. I do more in Java and VB.
Hi there!
Well, its a veeeery long time since I have written any C++ code
that actually works :) but 'Hello World' is the first one, and is
only centered about the cout command. (See below).
Havent included any header files for those two functions,
(cout and getch()), but just mark the word and hit ctrl + F1 in
your compiler window and the help file for that word will appear.
I guess, without seeing your code, that there is a misplaced
" > ; somewhere there, or that you have used a : instead of ;
(common beginner problem).
If you post your code, it would be easier.
void main()
{
cout << "\nBest regards " << endl;
cout << "Gobi " << endl;
getch();
}
(Yes, i know this code can be done mutch easier, but its for
the example, right?)