Beginning C++: Section 1, Part 20

The preprocessor directive I still don’t understand.

But I feel I have a understanding of the other elements of the code. The Expression statements are basically what I want to spit out and display, and I am using the declaration statement to tag variables within my code.

Like if I wanted to have A come up as 1 I could declare a to be 1…
int a = 1;
and then just write…
std::cout << a << std::endl;

I could really use some help explaing the #include and aspect.

Hey agam, I realize you’ve sent this 30 days ago, but essentially from my understanding, the preprocessor directive in this case allows you to access existing libraries of code to use in your own program. In this case you’ve included using the #include <> command, a library called iostream which allows you to use codes like
std::cout << "";
and
std::endl;

Notice these start with std which I believe refers to standard, and this is taken from the iostream library.

I could be wrong but this was my understanding and that’s how I’d explain it. Hope this helps :slight_smile:

Privacy & Terms