As an extra challenge, add these two features to your Part 1 solution:
cp grades.c extra.cAdd extra.c to your git repo:
git add extra.c git commit -m "Starting extra challenge" git pushCompile extra.c with:
gcc -g -Wall -o extra extra.c readfile.c -lmYou could try to modify the Makefile to add this command, but you do not have to. Here is some information about writing Makefiles if you want to try.
Implement your extra challenge solutions in a modular and generic way, i.e. it should work correctly for any sized data set and any sized histogram buckets.
40-59: ***** 60-79: **If you run your program on the same data set with a bucket width of 5, your histogram will look something like:
45-49: * 50-54: ** 55-59: ** 60-65: 65-69: * 70-74: 75-79: *If one bucket's range needs to be smaller than the others, it should contain the largest grade values, e.g. [..., 80-87, 88-95, 96-100].
#define HISTWIDTH 50for the maximum number of * characters allowed. Then, scale the number of stars for each bucket by the smallest power of 10 that keeps each line's length below that constant (rounding the number of stars up to ensure that all grades are represented). You should also print the scale so that users can interpret your histogram correctly. If the file contains 1000 grade values in the 40-59 range, 1101 in the 60-79 range, and 25 in the 80-99 range, your histogram might look like:
40-59: ********** 60-79: ************ 80-99: * scale: * = 100 grades
cp ~mauskop/public/cs31/makegrades.py .This program takes one command line argument specifying the number of values to generate. Here are two runs, one to generate 10 values, the other to generate 1,000 values:
python makegrades.py 10 python makegrades.py 1000You can redirect the output to a file and then use this file as input to extra.c (or grades.c).
python makegrades.py 10 > file_10.txt python makegrades.py 100 > file_100.txt python makegrades.py 1000 > file_1000.txt
The extra challenge is due at the lab 4 submission deadline. If you are submitting extra.c as a complete solution to the challenge part, add a CHALLENGE file to your git repo (so we can distinguish between attempted and submitted extra.c's).
echo "we did it" > CHALLENGE git add CHALLENGE extra.c git commit -m "Completed challenge" git push