Project 8

due at midnight on   +60

The goal of this assignment is to apply loops to string processing, treating strings as an array of characters. We will also revisit the full-line input technique:

    string input; // declare variable
    getline(cin, input); // get one line of text from user

Your program should repeatedly ask the user to type a one-line word or phrase. If they type end, then the program should stop. After they enter their phrase, your program:

  • prints the same phrase backwards
  • counts the number of vowels (A, E, I, O, U) in the phrase
  • if the phrase reads the same backwards as forwards, the program notes that it is a palindrome.

Here is a sample run:

Enter your text (or end): 2013
Backwards: 3102
Your input has 0 vowels.
Enter your text (or end): caravan
Backwards: navarac
Your input has 3 vowels.
Enter your text (or end): 1991
Backwards: 1991
Your input has 0 vowels.
Palindrome!
Enter your text (or end): ABBA
Backwards: ABBA
Your input has 2 vowels.
Palindrome!
Enter your text (or end): balloollab
Backwards: balloollab
Your input has 4 vowels.
Palindrome!
Enter your text (or end): balloon
Backwards: noollab
Your input has 3 vowels.
Enter your text (or end): end

Call your program p8str.cpp and submit to this dropbox for project 8.