Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Programming: Write a program that will read a line of text and output a list of all the letters that occur in the text

C++ Programming: Write a program that will read a line of text and output a list of all the letters that occur in the text together with the number of times each letter occurs in the line. End the line with a period that serves as a sentinel value. The letters should be listed in the following order: the most frequently occurring letter, the next most frequently occurring letter, and so forth. Case should be ignored ('a' should be treated the same as 'A'). If two or more letters have same frequency, print them in lexicographical order. The program will prompt the user to enter the lines of text in the terminal. The text line may contain any English letter and zero or more whitespace characters (spaces and tabs only).

The program should print a string of text to the terminal before getting each line of input from the user. A session should look like one of the following examples (including whitespace and formatting), with a possibly numbers and letters in the output:

Enter text: do be do bo. Frequencies: o 3 b 2 d 2 e 1 
Enter text: aaaaaaaaaabbbbbbbbbbcccccccccca. Frequencies: a 11 b 10 c 10 

The string printed by the program should include a newline at the end, but no other trailing whitespace (whitespace at the end of the line).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions