Question: Using the variables shown below and counter-controlled loops write a set of C++ statements that print a histogram like the one shown below as an

Using the variables shown below and counter-controlled loops write a set of C++ statements that print a histogram like the one shown below as an example. To print the histogram, your program must print as many '*' as indicated by the values read from the file on consecutive rows using nested for loops. Assume that the values in the file are all valid within the range 1 through 10. The file has exactly seven (7) values. For example, if the content of the input file is: 4 2 6 9 3 10 5 The histogram should look: **** ** ****** ********* *** ********** ***** ifstream myInfile; myInfile.open("input.txt"); int x, y; // to control the loops int max; // value read from the file ?(C++ language please!!)

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!