Link to home
Start Free TrialLog in
Avatar of tbell000
tbell000

asked on

average using the 4 highest scores of the 5 enterd

need help to find the averge of the 4 highest test scores
out of the 5 that were entered i think i need a func but i'm having trouble setting it  up..

#include <iostream>
#include <iomanip>
using namespace std;


void EvalGrade ( int Grade);
void FindAve (float Ave);
void Minimum(float,float,float,float,float);
{
  char letterGrade;
please email me a911hoe@msn.com with answ
 

   switch ( Grade/10)
   {
      case 10:
        case 9:
           
              letterGrade = 'A';
                break;

        case 8:
                 letterGrade = 'B';
                 break;

        case 7:
                letterGrade = 'C';
                break;

        case 6:
                letterGrade = 'D';
                break;

        case 5:
        case 4:
        case 3:
        case 2:
        case 1:
        case 0:
                letterGrade = 'F';



   }

   cout << "The letter grade is: " << letterGrade << endl;
   cout << "The Average is :" << ave << endl;
}

void main()

 {

     float Minimum(float test1,float test2, float test3, float test4, float test5)

         if (test1 < test2 && test1 < test5)
                return test1;
          if (test2 < test1 && test2 < test5)
               return test2;
          if (test3 < test1 && test3 < test5)
               return test3;
          if (test4 < test1 && test4 < test5)
               return test4;
          if (test5 < test1 && test5 <test4)
               return test5;

      FindAve

        Ave = test1 + test2+ test3 +test4 + test5 - Minimum / 4;
     
     return Ave


  int Grade;

   cout <<"Please enter Test 1\n ";
   cin >> Grade;

   EvalGrade ( Grade);

   cout << "Please enter Test 2\n";
   cin >> Grade;

   EvalGrade ( Grade);

   cout << "Please enter Test 3\n";
   cin >> Grade;

   EvalGrade ( Grade);

   cout << "Please enter Test 4\n";
   cin >> Grade;

   EvalGrade ( Grade);

   cout << "Please enter Test 5\n";
   cin >> Grade;

    EvalGrade ( Grade);
 


}
 


Avatar of tbell000
tbell000

ASKER

thanks for your help yesterday hope you can help today
also i have not accepted any ones answers
so all the points are your if you are correct
tbel000, I don't understand why you now have 3 questions asking about the same problem. Please keep working with the other experts who helped you in the last 2 threads and get things straightened out. They also need to receive credits for helping you as well. Please close two of these open questions as I suggested in the other thread.
ASKER CERTIFIED SOLUTION
Avatar of shivsa
shivsa
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
correction change last 3 lines with this. aftre min = Minimum(......);

Ave =(float)(test1 + test2+ test3 +test4 + test5 - min) /((float) 4);
        cout.setf(ios::showpoint);
   cout << "The Average is : " << Ave << endl;
please let us know if u have more questions.
here's a real nice way to do it. you won't beleive how short this thing is.

#include <vector>
#include <algorithm>
#include <numeric>

...

int main()
{
    float tmp;
    vector<float> grades = new vector();

    for(int i = 1; i < 6; i++)
    {
        cout << "Please enter Test " << i << "\n";
        cin >> tmp;
        grades.push_back(tmp);
    }

    float total = accumulate(grades.begin(), grades.end(), 0);
    float minimum = min_element(grades.begin(), grades.end());

    float average = (total - minimum) / 4.0;
}
add a

using namespace std;

in there (i always forget before i compile it the first time)
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: shivsa {http:#9815889}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer