Thread: Need opinion...
View Single Post
Old Jan 16th, 2005, 9:42 PM   #14
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
The << is a weird thingy that you don't need to know about. I barely understand it myself. All you need to know is that to print more than one thing, you just add it on the end:
cout << "Blah " << "More Blah" << endl;
endl stands for "end-line" and is used to create a line break.

iostream.h is a library containing several input and output functions, so you don't need to write them yourself. cout is one of these - it's not part of the language, but part of iostream.h, or Input/Output Stream Header. Actually, if you want to use ANSI C++, which is the more up-to-date version, you should use #include <iostream> (without the .h). You then use std::cout instead of cout, as it is part of the Standard Library in this header file. Of course, most people find this annoying, so you can also add
using namespace std;
after the #include. This instructs the compiler to use std whenever it can. You can then just use cout.

And finally, return 0. If you look above, you'll see it says int main(). The int part specifies this function returns an integer. As it is the main function, it returns it to the operating system, which can then parse the number and do something depending on it. But unless you're writing an application that interfaces with another in some way, I suggest leaving it as return 0. You can also use this statement before the end of the function to exit the program early.

If any of this is incomprehensible, I apologise - it's nearly 4am.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote