0

hi, my name is Ben,am new to c++ and i have this assignment to do.am stuck please somebody help me out
Frequency of letter pairs
Write a program to count the occurrences of all letter pairs in a sample of text (like the first
paragraph of the Constitution). Disregard differences between lower and upper case letters.
(Blanks are not considered as letters). Output the 100 most frequent letter pairs, in order by
percent of total. Also show which percent of total pairs is accounted for by this list of 100. Your
program should correctly process situations where the input file is empty or where less than
100 pairs occur.
Sample output
th 2.37% in 2.20% fj 2.00% ... (6 per line)
...
(100 letter pairs)
Output represents 73.44% of 23641 letter pairs.

4
Contributors
3
Replies
19
Views
2 Years
Discussion Span
Last Post by tinstaafl
0

I'd read it in letter by letter. The trick to get two letter pairs is to point it 2 letters infront.

Edited by iamthwee

0

You will probably want to use a a container like a map which will take key/value pairs. The two letter combination is the key and the value is the count.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.