Exercises

Here are some exercises that you can use to check your understanding of the binary and hexadecimal number systems.

Consider the two types of numeric variables we've encountered so far, short and unsigned short. Let's suppose that x is a short, and y is an unsigned short, both of them currently holding the value 32767, or 7fff in hex.

1.What is the result of adding 1 to y, in both decimal and hex?
2.What is the result of adding 1 to x, in both decimal and hex?

Answers to exercises can be found at the end of the chapter.

Get C++: A Dialog Programming with the C++ Standard Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.