Write a c++ program that confirms this phenomenon. Your program will be invoked from the command line like this:
C:\mydir> freqCount avonlea.txt avonlea.rept -all
It will then read through the first text file on the command line (in this case "avonlea.txt") accumulating the counts for each letter. When it reaches the end of the file, it will write a report (in this case "avonlea.rept") that displays the total number of alphabetic characters "azA- Z" and for each character the number of times it occurred and the relative frequency with which it occurred. In counting characters, regard lower case "a-z" and upper case "A-Z" characters as identical.You will need an array of 26 long integers, one per character. To increment the count for a particular character you will have to convert it into an index in the range 0..25. Do this by first determining which range the character belongs in:"a-z" or "A-Z" and then subtracting 'a' or 'A' from it, as appropriate:
int inx = (int)ch - (int)'A' ;
count[inx]++ ;
1
Expert's answer
2012-10-26T11:03:56-0400
Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.
Comments
Leave a comment