Having Some Trouble with an assignment


Write a program that prompts the user for the name of their favorite city (one word).
Display the number of letters in the entered city name, the city name with the 1st letter in upper case
and all other letters in lower case, with the last letter in upper-case and all the other letters in lower
case and the middle letter in upper-case and all of the other letters in lower case.

Your program should:
1. Display a welcome message.
2. Prompt the user for his/her favorite city which it then stores in a variable of type string.
3. Store the number of letters in the city name in a variable of type int.
4. Display the city name as it was entered by the user and the number of letters in it.
5. Display the city name with the second letter in upper-case.
6. Display the city name with the second to last letter in upper-case.
7. Display the city name with the middle letter in upper-case.
8. Display a farewell message, so that the user knows that the program has terminated normally.
Restrictions: No looping statements allowed (or needed). This questions requires the use of the
functions: at(), length(), substr(), tolower() and toupper().




SHOULD I USE THE MAIN FUNCTION AND IF YES THEN HOW?
ANY CHANCE OF SOME HELP?
THANK YOU
A program does nothing without the main function.

Also, this doesn't make sense:
ABZO wrote:
[...] the city name with the 1st letter in upper case and all other letters in lower case, with the last letter in upper-case and all the other letters in lower case [...]

[...]
5. Display the city name with the second letter in upper-case.
6. Display the city name with the second to last letter in upper-case.
[...]
This information is contradictory.
i highly doubt your instructor would of given you this assignment without any preparation.

SHOULD I USE THE MAIN FUNCTION

yes
Topic archived. No new replies allowed.