Well my class just learned functions but i don't seem to be quite getting it. So naturally trying to do my homework assignment i feel lost. I did make some good progress but i can't seem to get past this error. I don't know what it wants me to do.
error C2660: 'findLow' : function does not take 0 arguments
error C2660: 'calcAvg' : function does not take 0 arguments
The assignment is to create a program where the program asks for 5 test scores, finds the lowest and calculates the average of the other 4. All of this must be done in the functions, void getValues(); void calcAvg (int, int, int, int, int); and int findLow (int, int, int, int, int);
Finally here is my code. I hope you guys can help because im so lost and i have 4 function assignments due by next week :(
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
void getValues ();
int findLow (int s1, int s2, int s3, int s4, int s5);
void calcAvg (int s1, int s2, int s3, int s4, int s5);
void getValues ()
{
cout << "Enter five test scores: \n";
cout << "\t ";
int s1, s2, s3, s4, s5;
cin >> s1 >> s2 >> s3 >> s4 >> s5;
}
int findLow (int s1, int s2, int s3, int s4, int s5)
{
int lowest = s1;
{
if (s2 < lowest)
lowest = s2;
if (s3 < lowest)
lowest = s3;
if (s4 < lowest)
lowest = s4;
if (s5 < lowest)
lowest = s5;
cout << "lowest score is: " << lowest << endl;
return lowest;
}
}
void calcAvg (int s1, int s2, int s3, int s4, int s5)
{
float tot_4, avg;
{
tot_4 = (s1+s2+s3+s4+s5) - findLow();
avg = tot_4 / 4;
cout << "The average of four highest scores is: " << avg;
cout << endl;
}
}
int main()
{
getValues ();
findLow ();
calcAvg ();
return 0;
}