Structured Programming in C++
Prof. Gregory Safko
Camden County College, Cherry Hill Campus
Assigned: April 2, 2004
Due: April 9, 2004
Write a function makeUpper that takes in a string object, and returns it converted to uppercase.
The function will accept one string parameter, and will return the string converted to uppercase
The function prototype (above main) should look like this:
string makeUpper(string s);
Also write a suitable main program to demonstrate your function. Test it with the following strings:
String: Return value
College COLLEGE
r2d2 R2D2 (Numbers are not affected: they cannot be converted to “uppercase”)
3.14-15 3.14-15 (Numbers and punctuation are not affected: they cannot be converted to “uppercase”)
Write a function makeLower that takes in a string object, and returns it converted to uppercase.
The function will accept one string parameter, and will return the string converted to uppercase
The function prototype (above main) should look like this:
string makeLower(string s);
Also write a suitable main program to demonstrate your function. Test it with the following strings:
String: Return value
College college
B52’s b52’s (Numbers are not affected: they cannot be converted to “lowercase”)
3.14-15 3.14-15 (Numbers and punctuation are not affected: they cannot be converted to “lowercase”)
Write a function reverse that takes in a string object, and returns it in reverse order.
The function will accept one string parameter, and will return the string reversed
The function prototype (above main) should look like this:
string reverse(string s);
Also write a suitable main program to demonstrate your function. Test it with the following strings:
String: Return value
College egelloC
r2d2 2d2r
racecar racecar (Some words are already in reverse order! These are known as palindromes; a palindrome is word or phrase which is the same forwards and backwards. We will read in multiple words in a later lad, and test if they are palindromes using this function as a basis)