Help with hello world, I keep getting error!!
Heres the code I put in....
int main()
{
cout << "Hello people and world"; end1;
cout << "I want to be a programmer"; end1;
cin.get()
}
In the error it is saying it needs a ";" after < in iostream
I go ROTFL.
First, where are those #include? Then this person is a victim of fonts. It is not end-one, it is endl, that is, the lowercase letter l, meaning end-of-line. I myself has been bitten by l vs 1 before. But that's not so funny yet.
Ok newbie programmer, what do you think or want end1 will do for you? It is a character (Read your book!) and you want to pipe it to cout like your strings. So pipe it with cout << "Hello people and world " << endl;
That cin is to read a variable, should you pipe it to something?
You probably want the good old getchar() to read a key.
Happy Programming.
1 comment:
The cin at the end is there because Microsoft like to make the screen disappear after a program runs. unlike Borland used to do. This certainly promote bad habits to newbies. Sure, use cin instead of getchar() because getchar() is old school C.
The damn Arial font sucks and the letter l and the number 1 look exactly alike.
The poor beginner just can't type and mistake a ; with a pair of <
main should always return an int and that's missing.
Real C++ programmers are the few and the proud. Too many guys think they know C++ by just using // instead of /* */.
Post a Comment