Example: C++ array
// Histogram printing program using arrays // Note: Think about how this would be accomplished w/o arrays. #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 << "\n Element" << "\t" << "Value" << "\t\t" << "Histogram" << endl; for ( int i = 0; i < arraySize; i++ ) { cout << " " << i << "\t\t" << n[ i ] << "\t\t"; for ( int j = 0; j < n[ i ]; j++ ) // print # stars equal to cout << "*"; // value of array element cout << endl; } return 0; }