Question
Lab Vowel Program (cont.) CSCI 111 Programming and Algorithms I Task list: Create a source code file named lab.cpp. Start by prompting the user for
Lab
Vowel Program (cont.)
CSCI 111 Programming and Algorithms I
-
Task list:
-
Create a source code file named lab.cpp.
-
Start by prompting the user for a sentence and saving it into a variable of type string.
-
Determine the frequency of each of the 5 vowels (i.e. a, e, i, o, u) plus other unknown characters.
-
The determination of vowels should be case-insensitive which means lower and upper-case letters are
treated the same. It is mandatory to use the tolower function. Using the or statement can produce the same result, but 0 credit will be earned.
locale loc;
tolower(sentence[c],loc)) { 5. The program should also use the switch statement. Again, 0 credit will be earned without the the implementation of the switch statement.
-
-
6. The goal of this program is to prompt the user for 3 sentences. For each sentence, calculate the frequency of each vowel
7. After performing step 2 for all 3 sentences, determine which sentence has the most occurrences of a vowel and display the complete results as shown below.
8. It is OK to assume that there is never a tie of the most popular letter for each sentence. This will save much time. Hint: So, ensure your test data follows this rule.
9. Refer to the expected output listing below.
-
SAMPLE OUTPUT
Enter sentence 0. I just wAnt to BANG on the drum all day LONG. Vowel statistics a: 4 e: 1 i: 1 o: 3 u: 2 unknown: 34 The most popular letter for sentence 0 is >a< having 4 occurrences. Enter sentence 1. The teacher told ME to stay after school. Vowel statistics a: 3 e: 5 i: 0 o: 4 u: 0 unknown: 29 The most popular letter for sentence 1 is >e< having 5 occurrences. Enter sentence 2. The BOSS is a jerk. Vowel statistics a: 1 e: 2 i: 1 o: 1 u: 0 unknown: 14 The most popular letter for sentence 2 is >e< having 2 occurrences.
The sentence with the most popular vowel is sentence 1 having 5 occurrences of letter >>e<<.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started