Exercises

  1. Write a version of operator += for the string class. This function should concatenate its right-hand argument to its left-hand argument.

  2. Draw a picture of the functioning of the concatenation operator for strings when it is concatenating the value "Steve" onto a string containing the value "Hello,". Please note that there is a space before the second quotation mark in the latter value.

  3. Draw a picture of the functioning of the operator >> function for strings when it is reading data for a string of 85 characters.

  4. Draw a picture of the operation of the find_nocase function when it is searching for the value "purple" in a string with the value "A purple couch".

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.