Write a C++ function named louder which accepts a pointer to a C-string as its argument. It should do 3 things: - change any period (.) in the C-string to an exclamation point (!) - change any lower case letter in the C-string to the corresponding upper case letter - return the number of characters which were changed You may assume that parameter str points to a valid, null-terminated C-string containing only alphabetic characters, spaces and periods. You do not need to demonstrate calling this function. Example: if str points to an array containing "Giants win." the function should change the array so that it contains "GIANTS WIN!", and should return 9.
Write a C++ function named louder which accepts a pointer to a C-string as its argument. It should do 3 things:
- change any period (.) in the C-string to an exclamation point (!)
- change any lower case letter in the C-string to the corresponding upper case letter
- return the number of characters which were changed
You may assume that parameter str points to a valid, null-terminated C-string containing only alphabetic characters, spaces and periods. You do not need to demonstrate calling this function.
Example: if str points to an array containing "Giants win." the function should change the array so that it contains "GIANTS WIN!", and should return 9.
You must use this function signature:
int louder(char *str)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images