Related questions
Concept explainers
C++ Programming Instructions
Write a program that prompts the user for a sequence of characters (all typed on a single line) and counts the number of vowels ('a', 'e', 'i', 'o', 'u'), consonants, and any other characters that appear in the input. The user terminates input by typing either the period (.) or exclamation mark character (!) followed by the Enter key on your keyboard.
- Your program will not count white space characters.I.e., you will ignore white space characters.Though, the cin statement will skip white space characters in the input for you.
- Your program will not be case-sensitive. Thus, the characters 'a' and 'A' are both vowels and the characters 'b' and 'B' are both consonants.
For example, the input How? 1, 2, 3. contains one vowel, two consonants, and six other kinds of characters.
IMPORTANT: Your program must use the while statement only when looping. I.e., do not use a for statement or any other looping statement.
Test 1
> run
Enter text:
.
Your sentence has 0 letter(s).
Number of a's: 0
Number of e's: 0
Number of i's: 0
Number of o's: 0
Number of u's: 0
Number of consonants: 0
Number of digits: 0
Number of other characters: 0
Vowels make up 0% of the sentence.
Test 2
> run
Enter text:
!
Your sentence has 0 letter(s).
Number of a's: 0
Number of e's: 0
Number of i's: 0
Number of o's: 0
Number of u's: 0
Number of consonants: 0
Number of digits: 0
Number of other characters: 0
Vowels make up 0% of the sentence.
Test 3
> run
Enter text:
a.
Your sentence has 1 letter(s).
Number of a's: 1
Number of e's: 0
Number of i's: 0
Number of o's: 0
Number of u's: 0
Number of consonants: 0
Number of digits: 0
Number of other characters: 0
Vowels make up 100.00% of the sentence.
Test 4
> run
Enter text:
ia!
Your sentence has 2 letter(s).
Number of a's: 1
Number of e's: 0
Number of i's: 1
Number of o's: 0
Number of u's: 0
Number of consonants: 0
Number of digits: 0
Number of other characters: 0
Vowels make up 100.00% of the sentence.
Test 5
> run
Enter text:
apple.
Your sentence has 5 letter(s).
Number of a's: 1
Number of e's: 1
Number of i's: 0
Number of o's: 0
Number of u's: 0
Number of consonants: 3
Number of digits: 0
Number of other characters: 0
Vowels make up 40.00% of the sentence.
Test 6
> run
Enter text:
orange#pear!
Your sentence has 11 letter(s).
Number of a's: 2
Number of e's: 2
Number of i's: 0
Number of o's: 1
Number of u's: 0
Number of consonants: 5
Number of digits: 0
Number of other characters: 1
Vowels make up 45.45% of the sentence.
Test 7
> run
Enter text:
JacKsoN,MiSsiSSipPI.
Your sentence has 19 letter(s).
Number of a's: 1
Number of e's: 0
Number of i's: 4
Number of o's: 1
Number of u's: 0
Number of consonants: 12
Number of digits: 0
Number of other characters: 1
Vowels make up 31.58% of the sentence.
Test 8
> run
Enter text:
OsU ruLez, Cols, OH.
Your sentence has 16 letter(s).
Number of a's: 0
Number of e's: 1
Number of i's: 0
Number of o's: 3
Number of u's: 2
Number of consonants: 8
Number of digits: 0
Number of other characters: 2
Vowels make up 37.50% of the sentence.
Test 9
> run
Enter text:
Equation 5 * 3 - 2 / (3 % 5).
Your sentence has 19 letter(s).
Number of a's: 1
Number of e's: 1
Number of i's: 1
Number of o's: 1
Number of u's: 1
Number of consonants: 3
Number of digits: 5
Number of other characters: 6
Vowels make up 26.32% of the sentence.
Test 10
> run
Enter text:
You passed the final test :) AWESOME.
Your sentence has 30 letter(s).
Number of a's: 3
Number of e's: 5
Number of i's: 1
Number of o's: 2
Number of u's: 1
Number of consonants: 16
Number of digits: 0
Number of other characters: 2
Vowels make up 40.00% of the sentence.
\
Use strlength () function to count the number of characters .
Below is the code:
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- In vim, when the cursor is on the first letter of a word, you may capitalise it by typing x and then plarrow_forwardUsing a for Loop Summary In this lab the completed program should print the numbers O through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter- controlled while loop. Instructions 1. Write a for loop that uses the loop control variable to take on the values O through 10. 2. In the body of the loop, multiply the value of the loop control variable by 2 and by 10. 3. Execute the program by clicking the Run button at the bottom of the screen. Is the output the same?arrow_forwardne nouncements 2. Days of the Week odules • Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of the week, where 1- Monday, 2 - Tuesday and so forth. If the user types in a 6 then "Saturday" should be printed on the screen. For help with Input statements see: Input Function izzes • The program should print an error message if the user enters a number that is outside the range of 1 through 7. For help with If statements and conditions see the following pages: If-Else Statements and Operators. • Name the source code file yourName_HW4 1.py. • Test and run the program. Capture the output console and save it as an image file named yourName_HW3_output4_1.jpg. • Submit the py and the image files through Canvas. rades yllabus Zoom Library Research Guides 3. Roman Numerals • Write a program that displays the Roman numeral version of a decimal number entered. The program should prompt the user to enter a number from 1 to...arrow_forward
- In vim, you can capitalise a word by pressing x and then p while the cursor is on the first letter of the term.arrow_forwardC# Question Write a statement that declares a variable words and initialize it to the following list of words: "one", "two", "three"arrow_forwardDrawa structured flowchart , C++, write pseudocode that describes the process of guessing a number between 1 and 100. After each guess, the player is told that the guess is too high or too low. The process continues until the player guesses the correct number. Pick a number and have a fellow student try to guess it following your instructions.arrow_forward
- C++arrow_forwardProgramming language: F95 Write a program to declare two strings of length 7 each and then form a new string by concatenation of the two strings mentioned above. Print the two strings and concatenated string in the output.arrow_forwardc++ code clear and understandable pleasearrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education