I am in an Intro to Computing class and I have been doing fairly well but this program really has me stumped. This is our assignment:

The program will take as input a worker’s first name, last name, ID number (four digit number), and unit production numbers for the last 5 weeks. Each unit production number is an integer value indicating how many pieces the employee produced that week. Next the program will call a function that calculates the mean of the number of units. Next, the program will call a function that calculates the median of the number of units. Finally, the program will call a third function that prints the employee’s last name, the mean and the median that were calculated in the other two functions. The program will continue reading in information and printing the results until the user indicates that there are no more employees.

My problem is with the median. We haven't learned anything about arrays or sorting in the class. I do not want to do 120 "else-if" statements, but it is the only solution I have come up with. Any input from you guys about how to fix the function would be great and most appreciated.

```
#include <iostream>
#include <string>
using namespace std;
float Mean (int num1, int num2, int num3, int num4, int num5)
{//PURPOSE: Calculate the mean of the five numbers
//INPUT: five integers, weekOne, weekTwo, weekThree, weekFour, weekFive
//OUTPUT: the mean of the five numbers, avg
float avg=0;
avg=((num1+num2+num3+num4+num5)/ 5.0);
return avg;
}
float Median (int a, int b, int c, int d, int e) // variables named for easier coding
{//PURPOSE: Calculate the median of the five numbers
//INPUT: five integers, weekOne, weekTwo, weekThree, weekFour, weekFive
//OUTPUT: the median of five numbers, median
float median=0;
if (a<b && b<c && c<d && d<e)
cout<<a<<b<<c<<d<<e;
else if (a<b && b<c && d<c && e<d)
cout<<a<<b<<c<<e<<d;
else if ( < && < && < && < )
cout<< << << << << ;
return median;
}
void Print (string last, float m, float med) //parameters
{//PURPOSE:To print out three variables
//INPUT: the three reference parameters lastName, mn, md
//OUTPUT: the three variables, last, m, med
cout<<last<<", "<<m<<" and "<<med<<endl;
}
int main ()
{
string firstName, lastName;
char response;
int ID, weekOne, weekTwo=0, weekThree=0, weekFour=0, weekFive=0;
float mn=0, md=0;
cout<<"Do you have an employee to input? Y or N"<<endl;
cin>>response;
while(response=='Y')
{
cout<<"Enter first name, last name, ID number (four digits), and unit production numbers (for past five weeks)"<<endl;
cin>>firstName;
cin>>lastName;
cin>>ID;
cin>>weekOne;
cin>>weekTwo;
cin>>weekThree;
cin>>weekFour;
cin>>weekFive;
mn = Mean(weekOne, weekTwo, weekThree, weekFour, weekFive); //function call
md = Median(weekOne, weekTwo, weekThree, weekFour, weekFive);
Print (lastName, mn, md);
cout<<"Do you have an employee to input? Y or N"<<endl;
cin>>response;
}
return 0;
}
```

*Edited 4 Years Ago by deceptikon*: Fixed code tags