Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago