This is the question -----
Cryptographic analysis makes extensive use of the frequency with which let-
ters and letter sequences occur in a language. If an encrypted text is known
to be in english, for example, a great deal can be learned from the fact that
the letters E, L, N, R, S, and T are the most common ones used in written
english. Even more can be learned if common letter pairs, triplets, etc. are
For this problem you are to write a program which accepts as input a
text file of unspecified length and performs letter frequency analysis on the
text. The program will report the five most frequent letters used in the text.
The input for this program will be contained in a file called: data.txt and
will be stored in the same directory as your .cpp files. Please hard code this
into your assignment.
Your program should consider alphabetic characters only, and case should
be ignored (e.g. an ‘a’ is the same as an ‘A’).
A report should be produced using the format shown in the example at
the end of this problem description. The report should list the letters and
their frequency in descending order of frequency. If there are several letters
with the same frequency then these should be listed in alphabetical order as
shown. Finally, if there are less than five distinct letter frequencies in a text,
simply report as many distinct frequencies as possible. After this report,
your program should terminate.
When a text file containing simply the line
Peter Piper Picks Pickles!
is used as input, the output should appear as shown below.
I have been given a project which is due this week. I have tried my best but i couldn't come up with a right answer, as my program can't compile with too many errors. Urgent help needed.
I just want someone to give me an idea on how this program can be done.