Example, Printing a Bar Graph
Problem
- Print a bar graph that shows the volume of large lakes of the world. The input data are the names of the lakes and the volumes of the lakes in hundreds of cubic miles.
-
Solution
- We first print the name of the lake simply by echoing the input to the output a character at a time. The bar graph is created by printing a number of stars equal to the volume of each lake in hundreds of cubic miles.