#include <iostream>
#include <string>
#include <string.h>
using namespace std;
void getscores(int test1, int test2, int test3);
int calculateave(double);
void calculateminmax(int minimum, int maximum);
void display(int test1, int test2, int test3, int minimum, int maximum, double average);
int main()
{
int test1, test2, test3, minimum, maximum;
double average;
getscores(test1, test2, test3);
calculateave(average);
calculateminmax(minimum, maximum);
display(test1, test2, test3, minimum, maximum, average);
system("pause");
return 0;
}
void getscores(int test1, int test2, int test3)
{
cout << "Enter the first test score : ";
cin >> test1;
cout << "Enter the second test score : ";
cin >> test2;
cout << "Enter the third test score : ";
cin >> test3;
}
int calculateave(int test1, int test2, int test3)
{
double average;
average = (test1 + test2 + test3) / 3.0;
return average;
}
void calculateminmax(int test1, int test2, int test3, int minimum, int maximum)
{
if (test1 <= test2 && test1 <= test3)
minimum = test1;
else if (test2 <= test1 && test2 <= test3)
minimum = test2;
else
minimum = test3;
if (test1 >= test2 && test1 >= test3)
maximum = test1;
else if (test2 >= test1 && test2 >= test3)
maximum = test2;
else
maximum = test3;
}
void display(int test1, int test2, int test3, int minimum, int maximum, double average)
{
cout << endl << "Results ..." << endl;
cout << "The test scores are " << test1 << " and " << test2 << " and "
<< test3 << endl;
cout << "The average of the test scores is " << average << endl;
cout << "The minimum test score is " << minimum << endl
<< "The maximum test score is " << maximum << endl;
}