Here is my assignment that I am supposed to do and DId i do everything correct or did i leave out anything? I know I didnt write the output yet because im not concerned bout that right now did I follow that steps properly and I think Im little confused about how it's supposed to work because it is supposed to display the minimum and maximum of grades inputedusing passed to function and array
A)REad in 20 real values from the keyboard using the cin capablity. The values must be stored in an array. This input of data must be accomplished in the main function. I need to create a structure that contains variable for array, number of elements the minimum value and the maximum value. You must passthis structure as a pointer to each of the functions as a formal argument. (done that)
b) write a c++ function which will determine the minimum of grades input. The function will reuqire that the structure created in main function be passed as a pointer to this function as an argument. Data must be passed to this function as a argument.
c)Write a c__ function which will determine the maximum of the grades input. The function will require that structure created in main function be passed as pointer to this function as a argument. Data must be passed to this function as argument.
d)Maximum and minimum of grades input ust be written as output from a function (output) which is called from the main () function and not from the individual functions (MAX, min) Function will update the values.
E) write output function taht will display all values with appropritate identification on the printer. The function willr ecieve the sructure from the main function. All output must be accomplished using the cout capablity.
Here is my assignment that I am supposed to do and DId i do everything correct or did i leave out anything? I know I didnt write the output yet because im not concerned bout that right now did I follow that steps properly and I think Im little confused about how it's supposed to work because it is supposed to display the minimum and maximum of grades inputedusing passed to function and array
A)REad in 20 real values from the keyboard using the cin capablity. The values must be stored in an array. This input of data must be accomplished in the main function. I need to create a structure that contains variable for array, number of elements the minimum value and the maximum value. You must passthis structure as a pointer to each of the functions as a formal argument. (done that)
b) write a c++ function which will determine the minimum of grades input. The function will reuqire that the structure created in main function be passed as a pointer to this function as an argument. Data must be passed to this function as a argument.
c)Write a c__ function which will determine the maximum of the grades input. The function will require that structure created in main function be passed as pointer to this function as a argument. Data must be passed to this function as argument.
d)Maximum and minimum of grades input ust be written as output from a function (output) which is called from the main () function and not from the individual functions (MAX, min) Function will update the values.
E) write output function taht will display all values with appropritate identification on the printer. The function willr ecieve the sructure from the main function. All output must be accomplished using the cout capablity.
#include <iostream>
#include <stdlib.h>
Struct Student
{
float values [20];
int Num_elements;
float minimum,maximum;
};
void min (Student*);
void inputvalues (Student*);
void outputvalues (Student*);
void main()
{
Student Jeremy;
inputvalues (&Jeremy);
min(&Jeremy);
max(&Jeremy);
outputvalues(&Jeremy);
}
void inputvalues (Student*Temp)
{
float x;
int temp;
cout<< "Enter Array Data"<<endl;
<< "Enter -values to terminate input";
for(int i =0; i<20, i++)
{
cin >> x;
if (x<0)
break;
{
Temp=>Num_elements =i;
Temp=>Values [i] = x;
}
Void min (Student*Temp)
{
float min_temp=Temp=>values [0];
for ( int i =o; i<Num_elements, i++)
{
if (Temp=>values [i]< Min_Temp)
Min_Temp = Temp=.values [i];
}
Temp =>Minimum = Min_Temp;
}
Void Max(Student *Temp)
{int i;
float Max_Temp=Temp=>values [0];
for ( int i =o; i<Num_elements, i++)
{
if (Temp=>values [i]< Max_Temp)
Max_Temp = Temp=values [i];
}
Temp =>Maximum = Max_Temp;
}
return ;
}