|
-
Jul 5th, 2001, 11:12 AM
#15
Guru
In Standard C++, the header file iostream.h is not defined. A compiler doesn't have to have this header file to be compliant with the standard. Instead, there is iostream, and the namespace std.
Code:
// Instead of:
#include <iostream.h>
// You should use:
#include <iostream>
using namespace std;
// The rest of the code is the same:
int main()
{
cout << "Hello, world!" << endl;
return 0;
}
Oh, and also, instead of using "\n" it is common to use "endl", since "endl" also flushes the stream and "\n" doesn't.
There is an online compiler at http://www.comeaucomputing.com/tryitout/ which compiles (but does not link) your code. It's good for checking whether your code complies to the C++ standard. Great for finding all kinds of silly bugs in the VC++ compiler, and there are many
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|