Lowest Score Drop

how do you call main?
And Call calcAverage?

// Morris Lowest Score Drop.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include <iostream>
using namespace std;

void getscore(int &);
void calcaverage();

int main ()
{
int score1, score2, score3, score4, score5;

cout <<"Please enter five scores.\n\n";

getscore(score1);
getscore(score2);
getscore(score3);
getscore(score4);
getscore(score5);

averagescore = calcaverage();

cout <<score1<< " "<<score2<< " "<<score3<< " "<<score4<<" "<<score5<<endl;
cout <<"The average of the scores is " << averagescore << endl;
system ("pause");

return 0;
}
Last edited on
main(); (? I think this is what you're asking for)
Not 100% sure but I thing this would work. I'm sure there's an easier way.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
float calcAverage(const int&, const int&, const int&, const int&, const int&); // prototype

calcAverage(score1, score2, score3, score4, score5); // function call from main

float calcAverage(const int& value, const int& value2, const int& value3, const int& value4, const int& value5)
{
float avg =0;

float = (value + value2 + value3 + value4 + value5) / 5;

return avg;
}







Topic archived. No new replies allowed.