Question: #include #include using namespace std; int main(int argc, char *argv[]) { // check that user provided enough args and store them in local variables if

 #include #include using namespace std; int main(int argc, char *argv[]) {

#include #include using namespace std;

int main(int argc, char *argv[]) { // check that user provided enough args and store them in local variables if (argc

/* TODO: Produce a histogram of the data and write it to the hist file */

return 0; }

Program 1. A fully implemented program in rolldice.cpp simulates several rolls of a pair of 6-sided dice and records them in a datafile. Your task is to use skills from CSCI 10 to implement histogram.cpp to read values from a datafile and produce a text-based histogram of these values in a second file. For the first program, the user provides arguments specifying the number of rolls to simulate, the file that will store the data, and (optionally) a seed for the random number generator responsible for the simulation. For the second program, the user provides arguments specifying the number of rolls, the datafile, and the file where the histogram should be written; the code for parsing these arguments is already written for you. Then you can compile and run the two programs as follows to produce files that look like the ones below. (Omit the seed 2 to get different values each time, and increase the 15 to ~200 for a better visualization of the distribution.) For full credit, format your histogram file exactly like the sample run, including spacing. Bora Borvoo $ g++ rolldice.cpp -std=c++11 -o roll $ g++ histogram.cpp -std=c++11 -o hist $ ./roll 15 data.txt 2 $ ./hist 15 data.txt hist.txt 2: 3: * 4: 5: ***** 6: *** 7: *** 8: * 9:* 10: * 11: * 12: data.txt hist.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!