Workshop
车间提供测验的问题来帮助你olidify 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 E and be certain that you understand the answers before continuing to the next lesson.
Quiz
What is the difference between a signed integer and an unsigned integer?
Why should you not use#defineto declare a constant?
Why would you initialize a variable?
Consider theenumbelow. What is the value ofQueen?
enum YourCards {Ace, Jack, Queen, King};
What is wrong with this variable name?
int Integer = 0;
Exercises
Modifyenum YourCardsin Quiz Question 4 to demonstrate that the value ofQueencan be45.
Write a program that demonstrates that the size of an unsigned integer and a normal integer are the same and that both are smaller in size than a long integer.
Write a program to calculate the area and circumference of a circle where the radius is supplied by the user.
In Exercise 3, if the area and circumference were to be stored in integers, how would the output be any different?
BUG BUSTERS:What is wrong in the following initialization?
auto age;