Problem : What is the purpose of the #include statement in a C++ program?The #include statement tells the C++ preprocessor to insert the definitions of variables, classes, and functions into the current file. #include <iostream.h>, for example, lets you use the cout and cin functions, and #include <math.h> lets you use extra functions like the square root function sqrt(). To #include files that are not standard with C++ (files you define yourself, for instance) you use quotation marks instead of angle brackets. E.g.: #include "my_file.h"
Problem : Why should you comment your code?Commenting is important for documenting your code. Not only will it make your code much easier for other people to understand, but it will help to remind yourself what you were thinking if you look back at your code at a later time.
Problem : What is whitespace?Whitespace is the composition of spaces, tabs, and newlines that the compiler ignores when compiling your code. This means that you can use indentation and line spacing to make your code more readable.
Problem : Why must every program have a main() function?The main() function is where your program starts execution. Without it, a program would not know where to start (and thus couldn't be compiled).
Problem : What is a global variable?A global variable is a variable that is declared outside of main() and other functions and is visible everywhere in your program.
Take a Study Break!