//
Histogram printing program.
#include
<iostream>
using
namespace std;
int main()
{
const int arraySize = 10;
int n[ arraySize ] = { 19, 3, 15, 7, 11, 9, 13, 5, 17, 1 };
cout <<
"Element\tValue\tHistogram" << endl;
// for each element of array n, output a
bar in the histogram
for ( int i = 0; i < arraySize; i++ )
{
cout << i << “\t” << n[ i ] << “\t”;
for ( int j = 0; j < n[ i ]; j++ ) // print one bar
{
cout << '*';
}
cout
<< endl;
}