(Bar Chart) One interesting application of computers is drawing graphs and bar charts. Write a program that reads five numbers (each between 1 and 30). Assume that the user enters only valid values. For each number that is read, your program should print a line containing that number of adjacent asterisks. For example, if your program reads the number 7, it should print *******.
What will be an ideal response?
```
// Displaying bar charts using asterisks.
#include
using namespace std;
int main()
{
int number; // current number
cout << "Enter 5 numbers between 1 and 30: ";
// loop 5 times
for ( int i = 1; i <= 5; i++ )
{
cin >> number; // get a number from the user
// print asterisks corresponding to current input
for ( int j = 1; j <= number; j++ )
cout << '*';
cout << endl;
} // end for
cout << endl;
} // end main
```
You might also like to view...
This is the next generation of high-speed wireless connectivity. This technology promises data rates over 1Gbps and operates over the 5GHz band.
What will be an ideal response?
Angela wants to give her press release an attractive and cohesive appearance. How can she quickly format her press release so it uses common fonts, colors, and styles?
What will be an ideal response?
Desktop computers have two types of viewports: a visual viewport and a layout viewport.?
Answer the following statement true (T) or false (F)
Which of the following would be used to connect a singlemode fiber cable to a CAT6 connection?
A. Media converter B. T1-crossover C. Multimode cable D. Coaxial