c++ functions

Can someone please help me my programme is still not completely error free. Please i have been working on it all weekend long. I have tried several ways still not getting through/ Thank you.


#include<iostream>
#include<iomanip>

using namespace std;

{

float maxim (float grade);


float maxim= grade;
if(grade > maxim)
maxim= grade;

return maxim;
}


float smallest ( float grade)

{
float minim= grade;
if (grade < minim)
minim= grade;

return minim;

}


float average (float grade, float sum, int count)
{
float avg= sum/count;
return avg;

}

void printout (float minim, float maxim, float avg)

{
cout<<"The Largest is:" << maxim<<setprecision (2)<< endl;
cout<<" The Smallest is:" << minim<< setprecision (2)<< endl;
cout <<" The Average is:" << avg<< setprecision (2)<< endl;

}

int main ()

{
float grade, sum, minim, maxim, avg,name;
int count;
sum=0.0;
count= 0;
cout<<"Enter name then -1 to quit" << " Enter grade then -1 to quit";
cin >> name;
cin>>grade;
while (grade>=0.0)



printout (minim, maxim, avg);


return 0;

}
Last edited on
You are setting greatest/lowest to grade then comparing try setting to 0 then compare otherwise they always equal ( unlessfp )
Topic archived. No new replies allowed.