hi just starting to learn C++ and need to bounce i few questions off someone please

hi at the moment im reading teach your self c++ in 21 days as it was recomended to me on another forum before i found this one anyway the book doesnt realy tell you if you are doing it correct so id like to ask someone if im doing this correct 1st of all there is this

1: include <iostream.h>
2: int main()
3: {
4: cout << "Hello World\n";
5: return 0;
6: }

now i have to fix it and compile it and run it and say what it does

is this correct

#include <iostream>

using namespace std;

int main ()
{
cout << "Hello World \n";
return 0;
}

what it does is opens up a cmd window and in the window it just says Hello World

then there is this

1: #include <iostream.h>
2: int main()
3: {
4: int x = 5;
5: int y = 7;
6: cout "\n";
7: cout << x + y << " " << x * y;
8: cout "\n";
9:return 0;
10: }

now i was to guess what it done and i assumed it would open up a cmd windows
and display numbers and they would be spaced out from each other then i was to fix it and compile it and say what it done so heres what i done

#include <iostream>

using namespace std;

int main()
{
int x = 5;
int y = 7;
cout <<"\n";
cout << x + y << " " << x * y;
cout <<"\n";
return 0;
}

and when run it opend up a cmd window and in the window it said 12 35
is this correct or am i wrong on this one any help would be greatly appriecaited guys as i realy want to learn C++ and hopefully make my own programs instead of having to buy them eh ? anyway i look forward to the reply's
Your code is correct.

A book that uses iostream.h sounds like a bad book.
Ok thanks for letting me know my compiler told me it was decrepit and old and what i should use instead. I take it the book im reading is a old one then ? Should i continue to go through it all or find another ? Heres the link to the pdf that loads in yer browser so you can have a look and see if its ok or useless now and if i need a newer one and thanks for the help and advice

http://www.angelfire.com/art2/ebooks/teachyourselfcplusplusin21days.pdf
Topic archived. No new replies allowed.