So wrote this code all in main and it worked then tried to put it into function, per assignment, and i'm getting three errors both in the last function where I call the previous functions to print.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
ifstream infile;
void findHighest(int score1, int score2, int score3, int score4, int score5, int score6);
void findLowest(int score1, int score2, int score3, int score4, int score5, int score6);
void findAverage(int score1, int score2, int score3, int score4, int score5, int score6);
int main()
{
infile.open("posters.txt");
string name;
int score1;
int score2;
int score3;
int score4;
int score5;
int score6;
while(infile.peek() !=EOF)
{
infile >> name;
infile >> score1;
infile >> score2;
infile >> score3;
infile >> score4;
infile >> score5;
infile >> score6;
void findHighest(int score1, int score2, int score3, int score4, int score5, int score6);
void findLowest(int score1, int score2, int score3, int score4, int score5, int score6);
cout << "Results for: " << name << endl;
infile.ignore(1);
}
infile.close();
return 0;
}
void findHighest(int score1, int score2, int score3, int score4, int score5, int score6)
{
int max;
if(score1>=score2 && score1>=score3 && score1>=score4 && score1>=score5 && score1>=score6)
max =score1;
else if(score2>=score3 && score2>=score4 && score2>=score5 && score2>=score6)
max=score2;
else if(score3>=score4 && score3>=score5 && score3>=score6)
max=score3;
else if(score4>=score5 && score4>=score6)
max=score4;
else if(score5>=score6)
max=score5;
else
max=score6;
}
void findLowest(int score1, int score2, int score3, int score4, int score5, int score6)
{
int min;
if(score1<=score2 && score1<=score3 && score1<=score4 && score1<=score5 && score1<=score6)
min =score1;
else if(score2<=score3 && score2<=score4 && score2<=score5 && score2<=score6)
min=score2;
else if(score3<=score4 && score3<=score5 && score3<=score6)
min=score3;
else if(score4<=score5 && score4<=score6)
min=score4;
else if(score5<=score6)
min=score5;
else
min=score6;
}
void findAverage(int score1, int score2, int score3, int score4, int score5, int score6)
{
double sum;
double average;
char grade;
sum = score1 + score2 + score3 + score4 + score5 + score6;
average = (sum - max - min)/4;
if (average >= 8 && score1 >= 5 && score2 >= 5 && score3 >= 5 && score4 >= 5 && score5 >= 5 && score6 >= 5)
grade = 'A';
else if (average >= 6 && score1 >= 5 && score2 >= 5 && score3 >= 5 && score4 >= 5 && score5 >= 5 && score6 >= 5)
grade = 'B';
else
grade = 'C';
cout << "Highest: " << max << endl;
cout << "Lowest: " << min << endl;
cout << fixed << setprecision(2) << "Average: " << average << endl;
cout << "Grade: " << grade << endl;
cout << " " << endl;
}
on line 96 I get "cannot determine which instance of overloaded function "max" is intended"
on lines 105 and 106 I get "no operator "<<" matches these operands.
so I'm lost. Help Please.