Answer to Question #16271 in C++ for davood farajzade
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' ;
Submit it with all requirements as an assignment to our control panel and we'll assist you.
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!