| 1 | // File: fig0623.cpp |
| 2 | // Computer Systems, Fourth Edition |
| 3 | // Figure 6.23 |
| 4 | |
| 5 | #include <iostream> |
| 6 | using namespace std; |
| 7 | |
| 8 | void printBar (int n) { |
| 9 | int k; |
| 10 | for (k = 1; k <= n; k++) { |
| 11 | cout << '*'; |
| 12 | } |
| 13 | cout << endl; |
| 14 | } |
| 15 | |
| 16 | int main () { |
| 17 | int numPts; |
| 18 | int value; |
| 19 | int j; |
| 20 | cin >> numPts; |
| 21 | for (j = 1; j <= numPts; j++) { |
| 22 | cin >> value; |
| 23 | printBar (value); |
| 24 | } |
| 25 | return 0; |
| 26 | } |