Exercises

  1. What would happen if we compiled the program in Figure 8.34? Why?

    Figure 8.34. Exercise 1 (code\strex5.cc)

  2. What would happen if we compiled the program in Figure 8.35? Why?

    Figure 8.35. Exercise 2 (code\strex6.cc)

  3. We have already implemented operator < and operator ==. However, a concrete data type that allows for ordered comparisons such as < should really implement all six of the comparison operators. The other four of these operators are >, >=, <=, and != ("greater than", "greater than or equal to", "less than or equal to", and ...

Get Learning to Program in C++ 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.