2.1 The Parts of a C++ Program Flashcards
//
Marks the beginning of a comment.
Are comments required?
Comments are not required, as the compiler ignores everything from the double slash to the end of the line. However, they are very helpful to programmers.
If a line starts with #, what is it called?
Preprocessor directive
What does the preprocessor do?
The preprocessor reads your program before it is compiled and only executes those lines beginning with a # symbol. Think of it as a program that “sets up” your source code for the compiler.
What does the #include directive causes the preprocessor to do?
To include the contents of another file in the program.
What is the word iostream inside the bracket <iostream>?</iostream>
It is the name of the file that is to be included.
Where should the header file be included?
At the top of the program.
C++ uses namespaces to do what?
To organize the names of program entities.
What does the statement using namespace std; declares?
It declares that the program will be accessing entities whose names are part of the namespace called std.
What does int main() marks?
It marks the beginning of a function.
What is a function?
A function can be thought of as a group of one or more programming statements that collectively has a name.
What does the word int stands for?
Integer
Every C++ program must have this function.
the main function aka
int main ()
#
Pound sign
Marks the beginning of a preprocessor directive.
<>
Opening and closing brackets
Encloses a filename when used with the #include directive.