double average=0;
double lowest=0;
double total;
void getScore(&double,&double);
void getScore(double av, double lo)
{
int k;
cout<<"how many quizes"<<endl;
cin>>k
double[k] scoreList;
for(int i=0;i<k;i++)
{
// get score for each student put it in the array
}
for
{
// put the values in total
}
// cast k, and use k and total to find the average
double smallest = scoreList[i];
for
{
// step through array,
// use an if loop such as the user above mentioned
}
// etc, i apologize as i may have given you more hints than i should have, if not
//worse...
}
}
- In short, you can use whatever style works for you and you don't actually need your professor to teach you the language. In fact, reading ahead of time and/or watching tutorials will give you knowledge of the subject before the lecture, and will probably enable you to expand your knowledge upon the topic more than if you had simply waited for your professor to go over it.
You don't need to use arrays for this problem. You can perform the required calcs. as the user enters each value.
1) User enters numQuizzes.
2) Prompt for 1st score. Save this value as scoreTotal and as loScore, because so far it is both.
3) Each time user enters another score do 2 things:
a) add it to scoreTotal.
b) compare it to loScore. If it's less, then it's the new loScore.
4) After all scores are entered subtract loScore from scoreTotal, because the lowest score is thrown away.
5) Find average = scoreTotal/(numQuizzes-1);
The function signature you want is void getScore(double& av, double& lo) so that av and lo are passed by reference.
EDIT: That function may not meet all requirements. The instructions say to get the # of quizzes then call the function. You would need to pass numQuizzes to the function too. More like: void getScore_data(int numQuizzes, double& av, double& lo)