yeah folks you are right.instructor sent his example code lately. i hope it works
Code:
#include<stdio.h>
/**
function which reads data from the user
@param numbers[] array where the data is read
*/
void ReadNumbers(float numbers[])
{
int i;
for(i=0;i<20;i++)
scanf("%f",&numbers[i]);
}
/**
function that finds the lower and upper bound for the histogram
@param numbers array that the data is stored
@param min minimum number in the data
@param max maximum number in the data
*/
void FindBounds(float numbers[],float *min,float *max)
{
}
/**
function that finds the frequency list for the histogram
@param numbers array that the data is stored
@param frequency the frequencies for each interval
@param min minimum number in the data
@param max maximum number in the data
*/
void FindFrequency(float numbers[],int frequency[], float min,float max)
{
}
/**
function that prints the histogram
@param frequency the frequencies for each interval
*/
void DrawHistogram(int frequency[])
{
int i,j;
printf("\nHistogram:\n");
printf("x_axis:Frequency, y_axis:Values\n");
for(i=0;i<10;i++)
{
// frequency at interval with index i is printed at row i
for(j=1;j<=frequency[i];j++)
printf("-");
printf("\n");
}
}
/**
Main function. Reads the data, calculate frequencies and prints the histogram.
@return 0
*/
int main(){
float numbers[20],min,max;
int frequency[10]={0};
printf("*****Mini Histogram Tool*****\n");
printf("Enter data:\n");
// Readnumbers is called for reading data
ReadNumbers(numbers);
// FindBounds is called for finding the upper and lower bound for the histogram
FindBounds(/*Enter parameters!!!*/);
// FindFrequency is called for calculating the frequencies
FindFrequency(*Enter parameters!!!*/);
// DrawHistogram for printing the histogram
DrawHistogram(frequency);
system("pause");
return 0;
}