I need to complet this program: program red test scores up to100 from a data fil
ID: 3617754 • Letter: I
Question
I need to complet this program: program red test scores up to100 from a data file of unknown length and compute theaverage and the maximum value of an array. I started the programjust need to complet the missing codes. #include<iostream> #include<fstream> using namespace std; const int MAX= 100 //consttant declaration for arraysize //need function prototypes void Getinput(float[], int&); int main() { float scores[MAX]; //score array intsize; //actual number of actual scores float maximum //largest value in the array floataverage; //average of scores ifstreaminData; //inputstream variable Getinput(scores,size); //readscores into array .............. //determine maximum of array cout<<"maximum of"<< size<<"scores:"<<maximum<<endl; return0; } //GetInput function heading....... { ifstream inData; size=0; .......................// open file"input.txt" inData>>floatArray[size++] //priming read- first score whie(inData) inData>>floatArray[size++] ............................// adjust size } .........................//compute average heading { .................. .............. for(i=0; i < size; i++) sum+= floatArray[i]; ........................... } ................................// find max heading { float max; max= floatArray[0]; int i; for(i=0; i < size; i++) if(max < floatArray[i]) maxe= floatArray[i]; ................................... } I need to complet this program: program red test scores up to100 from a data file of unknown length and compute theaverage and the maximum value of an array. I started the programjust need to complet the missing codes. #include<iostream> #include<fstream> using namespace std; const int MAX= 100 //consttant declaration for arraysize //need function prototypes void Getinput(float[], int&); int main() { float scores[MAX]; //score array intsize; //actual number of actual scores float maximum //largest value in the array floataverage; //average of scores ifstreaminData; //inputstream variable Getinput(scores,size); //readscores into array .............. //determine maximum of array cout<<"maximum of"<< size<<"scores:"<<maximum<<endl; return0; } //GetInput function heading....... { ifstream inData; size=0; .......................// open file"input.txt" inData>>floatArray[size++] //priming read- first score whie(inData) inData>>floatArray[size++] ............................// adjust size } .........................//compute average heading { .................. .............. for(i=0; i < size; i++) sum+= floatArray[i]; ........................... } ................................// find max heading { float max; max= floatArray[0]; int i; for(i=0; i < size; i++) if(max < floatArray[i]) maxe= floatArray[i]; ................................... }Explanation / Answer
please rate - thanks #include #include using namespace std; const int MAX= 100; //consttant declaration for arraysize //need function prototypes void getinput(float[], int&); float getaverage(float [], int); float findmax(float [], int); int main() { float scores[MAX]; //score array intsize=0; //actual number of actual scores float maximum; // largestvalue in the array floataverage; //average of scores getinput(scores,size); //read scoresinto array coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.