Question: I have a question on c programming. I am trying to place numbers gotten from the user into 5 different histogram bins but I don't
I have a question on c programming. I am trying to place numbers gotten from the user into 5 different histogram bins but I don't know to go about it. This is my unfinished code.
#include
void GetNumMeasurement();
void GetMeasurement();
void UpdateBin();
void main()
{
int a;
int e;
int d;
char m;
do
{
printf("Please enter the minimum and maximum values for the measurements: ");
scanf("%d%d",&a,%e);
if(e-a>=6)
{
printf("The values entered (%3.3d %3.3d) difference must be 5 ");
}
if(a>e)
{
printf("The values entered (%3.2d %3.2d) are not valid. The minimum value should be less than the maximum ")
}
}
while(e-a>=6)
GetNumMeasurement();
GetMeasurement();
do{
printf("Do you have another batch
scanf("%c",&m);
if(m='Y')
{
GetNumMeasurement();
GetMeasurement();
}
if(m='N')
{
}
}
}
void GetNumMeasurement()
{
do
{
printf("How many measurements are there for this batch: ");
scanf("%d",&d);
if(d<1)
{
printf("he number of measurements per batch must be at least 1.")
}
}while(d<1)
}
void GetMeasurement()
{
int i,n;
do{
for(i=1;i<=d;i++)
{
printf("Please enter a measurement%d: ",i);
scanf("%d",&n);
if(a>n>e)
{
printf("the measurement must fall in the range between the expected minimum and maximum");
}
}
}while(a>n>e)
}
int GetNumMeasurement()
{
int num;
printf("How many measurements are there for this batch: ");
scanf("%d",&num);
return num;
}
int GetMeasurement()
{
}
I am supposed to use 3 functions namely GetNumMeasurement, GetMeasurement and Updatebin.
GetNumMeasurements() Returns the validated number of measurements for a batch
GetMeasurement Returns a single validated measurement from the user
UpdateBin Returns the updated value for a given bin based on a measurement (this function
should be called 5 times, once for each bin).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
