Hi there,

I'm completely new to C++ programming and need to find out/verify something in the code below...

// my first program in C++
#include <iostream>
using namespace std;
int main ()
{
  cout << "Hello World!";
  return 0;
}

From a web site I (believe I) understand the following quote...

The #include is a "preprocessor" directive that tells the compiler to put code from the header called iostream into our program before actually creating the executable.

But what exactly does the hash (or pound) sign do?

Does it simply tell a compiler that a header file is coming up?

Or is it saying that a "directive" is coming up?

And, in the quote above, what is "our program?"

Is it the compiler/source code?

And, no, this is not my homework.

Thanks.

I think I've worked it out...

The hash sign indicates that it will soon be 'directing' the compiler to do something. In this case, it will tell the compiler to include the 'iostreamer' file.

The 'iostreamer' file is a header file and thus (because it is a header file) it will be included in another source file (i.e. 'our program') by the compiler, before the compiler creates the executable file.

If anyone can confirm this, that would be great.

Thanks.

Look if you mean the hash sign beside iostream then from what i know is that it allows the complier to understand incomings and outgoings and process according to iostream is like input/output which is what ur cout does so it executes it i hope i did help .... anyone plz correct me if i am wrong

>But what exactly does the hash (or pound) sign do?
It says "this is a preprocessor directive". All preprocessor directives start with that character.

>And, in the quote above, what is "our program?"
"Our program" in this case is the translation unit, which is (put simply) the source code after the preprocessor has run.

>anyone plz correct me if i am wrong
I'm sure you're wrong, but because what you said is basically gibberish, I can't say why it's wrong. ;)

This question has already been answered. Start a new discussion instead.