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.

So what do you have so far? What are you stuck on.

Member Avatar for iamthwee

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.