Hi, I am new to programming and am having trouble with this homework assignment. I am confused about how to implement the histogram and frequency. Any help will be greatly appreciated. :)
// Frequency distribution and bar graph program. User inputs 10 #s that range from 5-15 and is checked for validation.
// Prints the # of times each score occurs and also prints a horizontal bar graph that plots the non-0 frequency counts.
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
// create array to store #s
const int SIZE = 10;
int num[SIZE];
int i = 0;
while (true)
{
// get 10 numbers from user
cout << "Please enter 10 #s b/w 5-15 (separate each # w/a space): ";
cin >> num[i];
// verify if valid, if not loop
if (num[i] >= 5 && num[i] <= 15) break;
cout << "All numbers are not b/w 5-15. Please try entering them again." << endl;
} // while
// loop for frequency & histogram
for(i = 0; i < SIZE; i++)
{
num[i]++;
int j;
for(j=0; j<num[i]; j++)
{
cout << "*";
} // for
} // for
return 0;
}