Sams Teach Yourself C++ in 21 Days

(singke) #1
it is a difficult transition to give it up. New styles look wrong and create confusion.
If you get bored, try logging in to a popular online service and asking which inden-
tation style works best, which editor is best for C++, or which product is the best
word processor. Then sit back and watch as ten thousand messages are generated,
all contradicting one another.
Q Is that it?
A Yes! You’ve learned C++, but... there is always more to learn! Ten years ago, it
was possible for one person to learn all there was to know about a computer pro-
gramming language, or at least to feel pretty confident about being close. Today, it
is out of the question. You can’t possibly catch up, and even as you try, the industry
is changing. Be certain to keep reading, and stay in touch with the resources—
magazines and online services—that will keep you current with the latest changes.

Workshop ............................................................................................................


The Workshop provides quiz questions to help you solidify your understanding of the
material covered and exercises to provide you with experience in using what you’ve
learned. Try to answer the quiz and exercise questions before checking the answers in
Appendix D, and be certain you understand the answers before continuing to the final
Week in Review.

Quiz ................................................................................................................



  1. What is an inclusion guard?

  2. How do you instruct your compiler to print the contents of the intermediate file
    showing the effects of the preprocessor?

  3. What is the difference between #define debug 0and #undef debug?

  4. Consider the following macro:
    #define HALVE(x) x / 2
    What is the result if this is called with 4?

  5. What is the result if the HALVEmacro in Question 5 is called with 10+10?

  6. How would you modify the HALVEmacro to avoid erroneous results?

  7. How many bit values could be stored in a two-byte variable?

  8. How many values can be stored in five bits?

  9. What is the result of 0011 1100 | 1111 1111?

  10. What is the result of 0011 1100 & 1111 1111?


788 Day 21

Free download pdf