Create a C++ file named benford

$16.00

Category:

Description

Assignment
Create a C++ file named benford.cpp.
In benford.cpp, your main function should prompt for the name of a data file and then the function iterates through the all of the elements in the data file and computes the frequency (count and percentage) of the first number in each entry.
Note: Some of the data files have comments that you must filter out.
Also note: that blank lines or lines where the number begins or is 0 must also be filtered out.
Your output must be formatted as follows.
DigitCountFrequency
130.30
220.20
320.20
400.00
500.00
600.00
720.20
800.00
910.10
Sample Data Files
Clarification, from this list your program must be able to handle sample1.txt, sample2.txt, sunspots.txt, livejournal.txt, and librarybooks.txt.

sample1.txt – small sample input file with no degenerate cases.
sample2.txt – small sample input file containing blank lines and 0’s.
Sunspot data (Links to an external site.) collected by Robin McQuinn. The number of sunspots that occur monthly, as compiled by a Belgian agency taken from http://sidc.oma.be/html/sunspot.html.
LiveJournal starts (Links to an external site.) collected by Shirley Man. The number of new LiveJournal accounts created daily Jan 1, 2000–Feb 28, 2005, taken from http://www.livejournal.com/stats/stats.txt, field name “newbyday”.
Library holdings (Links to an external site.) collected by Christian Ayotte. The number of books held in a set of several thousand US libraries, from an Access database at: http://nces.ed.gov/pubs2004/data/PUPLD02a_Access.zip.

101481     101481
10974        10974
1013        1013
28292       0
35040     2829
35372      35040
7155      35372
7284      7155
96110     7284
26175      96110
26175