Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

/* Student ID : Your student ID #.20129121 Due date : April 15, 2015 Purpose of

ID: 651806 • Letter: #

Question

/*
Student ID : Your student ID #.20129121
Due date : April 15, 2015
Purpose of the program :
Create function that produces a random number.
Create a main function with a loop and shows histograms
Section 1: Create a function ?int roll()? that returns a value from 1 to 5.
Section 2 Main Function. Set the random number seed with 1 followed by last 4 digits of your student ID.
Section 3 Call "roll" function 200 times while keeping count of each number. (You are required to use an array)
Section 4 Show the results, and display a histogram.
Section 5 Call "roll" function 8 times, and add those numbers
Section 6 Repeat "Section 5" 1,000,000 times while keeping count of each number. (You are required to use an array
Section 7 Show the results, and display a histogram. This time each "*" represents 2000.
*/

Must hafve output in that format. i had this answered this question answered yesterday but the output was wrong and i am completely lost

Explanation / Answer

#include<iostream>

#include<iomanip>

using namespace std;

int roll()
{
return (rand() % 7) + 1;
}


void main()
{
int ary[9] = { 0 };

int arx[43] = { 0 };
int id = 19121;
srand(id);

int i, j;

for (i = 1; i<=200; i++)
{
ary[roll()]++;
}

for (i = 1; i < 8; i++)
{
cout << setw(1) << i << ":" << setw(6) << ary[i] << ':';

for (j = 0; j<ary[i]; j++)
{
cout << "*";
}
cout << endl;
}

for (i = 0; i<1000000; i++)
{
arx[roll() + roll() + roll() + roll() + roll() + roll()]++;
}
for (i = 8; i<41; i++)
{
int j;
cout << setw(2) << i << ":" << setw(8) << arx[i] << ":";

for (j = 0; j<arx[i]; j += 2000)
{
cout << "*";
}
cout << endl;

}