String
Manipulation Lab
Lab
9. Manipulate a word using library functions.
- Declare an
array to store one word.
- Prompt operator
to enter a word.
- Call the
string length library function (strlen) to display the
length of the word.
- This replaces
your string length function.
- Convert
the word to uppercase. (Display from main).
- HOW:
Pass the word.
- Set up
a loop looking for the NULL.
- Within
the loop, call the library function (toupper) to
convert each character to uppercase.
- Determine
if the word is a palindrome (spelled same backward as forward
-- example: radar, deed, civic).
- HOW:
Write a function to copy the word in reverse
order.
- Use the
string compare library function (strcmp) to compare
the original word with the reversed word.
- Report
the results in main.
Test Data:
level
racecar
banana
peep
Submit:
Source code
Output
Back
to Top
|