below my program and i just want to add function that find highest grade
can anyone help me
#include <iostream>
#include <cmath>
using namespace std;
#define NUM_ELEMENT 100
int main(int argc, char **argv)
{
float scores[NUM_ELEMENT]; //declare array of scores
int numScores=0; //declare number of scores
//Ask user to put number of scores
cout<<"Please enter number of how many test score you want to add: ";
cin>>numScores;
if(numScores>NUM_ELEMENT)
{
//inform to user
cout<<"Too many scores! The max number it can be is: "<<NUM_ELEMENT<<endl;
return 0; //exit program
}
//ask for scores
for(int i=0;i<numScores;i++) //for each score
{
//get score from user
cout<<"Please enter score for test "<<i<<": ";
cin>>scores[i];
}
//calculate average
float avgScore=0; //The average score, init to 0
for(int i=0;i<numScores;i++) //for all scores
{
avgScore+=scores[i]; //accumulate them
}
avgScore/=numScores; //calculate final average score
//output to user
cout<<"THe average score is: "<<avgScore<<endl;
We're not going to do it for you... start here (pseudo-code):
1 2 3 4 5 6
float functionName(float arrayName[])
{
// loop through each position in the array
// each iteration, check to see if the number at position "i" (your counter variable) is greater than the value in a variable storing your current largest number
// return the variable storing the largest number
}