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

Read Malik\'s: pages 519-549 Write a C++ program that rolls two dice, uses an ar

ID: 3881758 • Letter: R

Question

Read Malik's: pages 519-549 Write a C++ program that rolls two dice, uses an array to record the frequency of the values of the addition of the two dice, so it will record how many 2's, 3's, 4's.... 12's was the result of throwing the dice n times. The user will input n. The program will output a table showing the number of times and percentage of each sum. What is the most likely outcome when throwing two die? Write the following functions: int RollDie) Returns the value of rolling the die once void PrintTable(unsigned int[], unsigned int) Prints a very nice table with the results from 2 to 12 void InitializeArray(unsigned int[]. unsigned int, unsigned int-e) Initializes the array with the values of the third parameter . void WriteArray(unsigned int[], unsigned int, ostream&) Writes the array into output file given in the third parameter unsigned int MaxSum(unsigned int[], unsigned int) Gets the value of summation that repeated the most

Explanation / Answer

# include <iostream.h>

#include<fstream.h>

int main()

{

                ofstream fout;

fout.open(“RANDOM_NUMBERS”);

fout<<”5 ”;

fout<<”12 ”;

fout<<”99 ”;

fout<<”45 ”;

fout<<”33 ”;

fout<<”8 ”;

fout.close();

int N=80,odd[N],even[N],i=0,x;

ifstream fin;

fin.open(“RANDOM_NUMBER”);

while(fin)

{

fin.getline(x,N);

if(x%2==0)

{

                even[i++]=x;

cout<<”even= ”x;

}

else

{

                odd[i++]=x;

cout<<”odd= ”x;

}

}

fin.close();

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote