using a funtion to find the average of test scores

i 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 with answ

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

        case 8:
                 letterGrade = 'B';

        case 7:
                letterGrade = 'C';

        case 6:
                letterGrade = 'D';

        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;


         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);

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tbell000, you're posting the same question twice. You can post a message to Community Support and ask them to close this one question and refund the points.
Sounds like you need a bubble sort to order the grades highest to lowest and then use the first 5 grades.

That way you can enter as many as you like and only then average the best 4 or however many you wish to see.

This is an old routine for sorting most occuring lotto numbers.
MOSTLOTTO is a structure that holds the numbers 1 to 53 and
the amount of times shown for each of the numbers.

struct LOTTO
char NumberString[10]; // 1 to 53 for displaying
int   Num; // amount of times shown.


//some other function to read values into MOSTLOTTO

//bubble sort
void SortMOST(int end)
int top, search, temp;
for(top=0;top < end-1;top++)  
for(search=top+1;search < end;search++)  
if(MOSTLOTTO[search].Num > MOSTLOTTO[top].Num)
 temp = MOSTLOTTO[search].Num;
 MOSTLOTTO[search].Num = MOSTLOTTO[top].Num;
  MOSTLOTTO[top].Num = temp;
}// end if
}// end for
}// end func

So now if I wanted to I could use only the first 4 elements of MOSTLOTTO to do an average on.

int LottoAverage = (
MOSTLOTTO[0].Num) / 4;

So now your logic would go

(semi pseudo code)



begin func
begin outer loop
clear screen;
Prompt menu "(L)oad, (A)verage, e(X)it"

prompt (exit) break;

prompt how many >> in
int val=0;
int x=0;
adding loop
add from YOU[x].yyy or xx to val ,then x++ untill x== in
}//end adding loop
answer = val / in;
}//endif A


}//end outer loop



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.