(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...
What can you use for sources of data for mailing labels? Is there anything special you would do for mailing labels based on parameter queries?
What will be an ideal response?
The outcomes of the ____________________ serve as the permanent repository for project issues, concerns, and their resolution.
Fill in the blank(s) with the appropriate word(s).