Exercises ........................................................................................................
- This program initializes two integer variables (numbers) and then prints out their
sum, 12, and their product, 35. - See your compiler manual.
- You must put a #symbol before the word includeon the first line.
- This program prints the words Hello Worldto the console, followed by a new line
(carriage return).
Day 2....................................................................................................................
Quiz ................................................................................................................
- Each time you run your compiler, the preprocessor runs first. It reads through your
source code and includes the files you’ve asked for, and performs other housekeep-
ing chores. The compiler is then run to convert your preprocessed source code to
object code.
2.main()is special because it is called automatically each time your program is
executed. It might not be called by any other function and it must exist in every
program. - C++-style, single-line comments are started with two slashes (//) and they com-
ment out any text until the end of the line. Multiline, or C-style, comments are
identified with marker pairs (/ /), and everything between the matching pairs is
commented out. You must be careful to ensure you have matched pairs. - C++-style, single-line comments can be nested within multiline, C-style comments:
/ This marker starts a comment. Everything including
// this single line comment,
is ignored as a comment until the end marker /
You can, in fact, nest slash-star style comments within double-slash, C++-style
comments as long as you remember that the C++-style comments end at the end of
the line. - Multiline, C-style comments can be longer than one line. If you want to extend
C++-style, single-line comments to a second line, you must put another set of dou-
ble slashes (//).
822 Appendix D
32 0672327112_app_d.qxd 11/19/04 12:30 PM Page 822