Hey I am making a program where it takes an occupation and their salary and calculating the average and the median of all the salaries from said occupation in a text file. How do I make a function to make it it order the occupation ascending order fro A-Z with their salaries ?
use the bubblesort method, or use substrings and compare all the first letters of the occupation. capital A has the largest value and small z has the lowest
int Lrg_Pos(int st_pos, int l_pos)
{
int i, n;
i = st_pos;
for(n = Lrg_TM + 1; n < l_pos - 1; n++)
if((salary[n]) > (salary[i]))
i = n;
return i;
}
//st_pos is the start position where you wanna start the sorting and l_pos is the last
// then use a swap function
void swap (double &A,double &B)
{
double Temp;
A = Temp;
B = A;
Temp = B;
}