Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Urgent help needed in c++ program ! Thanx :) In C++, you can generate random numbers by calling a function named rand () which is

Urgent help needed in c++ program ! Thanx :)

image text in transcribed

In C++, you can generate random numbers by calling a function named rand () which is defined in header file. To generate random numbers between 1 and an integer N use the expression: (rand ( ) % n + 1) . Write a program that simulates the tossing of 100 dices and prints a histogram of the results. The following is sample outcome: One: Two: Three: Four: Five * * Six: Represent your histogram as an array of bars each of which has the following structure: enum Sidef ONE, TWO, THREE, FOUR, FIVE, SIX struct Bar int value; Side label; Your program should create and use at least the following three functions string getSideLabel (Side s) / returns the string label for each void generateData (Bar hist[], int tossesCount= 100); // Randomly // of the enumerated sides // generate the dice tosses. By default 100 tosses will be // generated. The results are saved into the array histI) string getAistogram (Bar hist[], char c = '*'); // Generate the whole // histogram and returns it as a string to be printed out in // the main function. Be default * will be used to create bars

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

Project management skills and/or experience desirable

Answered: 1 week ago