Question
Write a C++ program that reads in text one character at a time and counts the number of occurrences of the following letters: 'a', 'g',
Write a C++ program that reads in text one character at a time and counts the number of occurrences of the following letters: 'a', 'g', 'm', 'f', 'k', and'j' in the text, and determines a total score for the text using a point based scheme. Both lower case and upper case letters should be counted together. When a period, ".", or exclamation mark, !", appears in the input text, the program prints how many of each letter above only, the total score of the text, and halts. Each letter being counted is assigned a score (similar to the board game Scrabble) as follows: 'a' (1 point), 'g' (2 points), 'm' (3 points), 'f' (4 points), 'k' (5 points"), and 'j' (8 points). All other characters have a score of - points. You will compute the total score of the input text by summing the number of occurrences of a letter above multiplied by its score. For example, if the input text is: she made a familiar attempt Just right., then the counts are 5 'a', 1 'g', 3 'm', 1 'f', 0 'k', and 1 ''j'. The total score for the phrase is 5 * 1 + 1 * 2 + 3 * 3 + 1 * 4 + 0 * 5 + 1 * 8 = 28
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