Hi everyone
I am new to the forum and completely new to programming.
i started to learn C++ today with no previous experience in coding at all (apart from some very basic HTML).
i am using a book that at first seemed great, but as im getting into it it seems that it might be quite inaccurate.
for example, i was building the first program, which is the hello world program, and in the book it tells me to put this code
1 2 3 4 5 6 7
|
#include <iostream.h>
int main()
{
cout << "Hello World!\n";
return 0;
}
|
which did not work at all. after some googling and some helpful threads on this forum i managed to piece the problems together and ended up with this code
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World";
cout << "Press ENTER to continue...";
cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
return 0;
}
|
there are huge differences in these two codes, which makes me doubt the author of the book.
is the first code ok? does it depend on the compiler?
i used microsoft visual C++ express to build and compile it.
is that compiler any good? are there better free compilers around?
thank you all for the help, and sorry for the complete newb questions