Chapter 7 Exercise Set 1¶
Write the code from the Containers for strings section in a file named
hello_strings.cpp, compile it, and run it.
Write a function that takes a
stringas an argument and that outputs the letters backwards, all on one line.
Encapsualte the code from the Looping and counting section in a function named
count_letters, and generalize it so that it accepts both the string and the letter as arguments.
count_lettersfunction from the previous exercise so that instead of traversing the string, it uses the
Fix the code in String concatenation so that “Ouack” and “Quack” are spelled correctly.
cctypelibrary write functions
string_to_lowerthat take a single
stringas an argument and return a string consisting of all upper or lower case letters.