Question
Write a C++ program that assists in the solving of a cryptogram by reading text until the user types -D, then displays of the number
Write a C++ program that assists in the solving of a cryptogram by reading text until the user types
Functional requirements:
Prompt the user to enter the text.
Read each character typed, incrementing a counter for corresponding letters. You need not keep track of non-alphabetic characters. Uppercase and lowercase characters should be treated identically (i.e. you need to maintain only 26 counters, with 'C' and 'c' both incrementing the same counter).
Sort the letters by number of occurrences in the text in descending order.
Print a list of letters and their number of occurrences, in descending order.
Implementation requirements:
You must use 2 arrays of 26 elements: the first is an array of characters, with each element initialized to the corresponding alphabetic character. The second is an array of longs, initialized to 0.
Your sorting algorithm must move corresponding elements in both arrays, based on the value stored in the counter array. That is, you must treat the two arrays as parallel arrays.
You must use one function to read the text and count the occurrences of each letter, a second to sort the parallel arrays, and a third to print the results. Appropriate use of const parameters is required.
Sample output:
miller: a.out
Enter the cypher text (-D to end): Iqmmw Twpmv!
M 3
W 2
I 1
P 1
Q 1
T 1
V 1
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