### anyone have any code to classify Salaries ascending or descending to this program

How do I print Salaries from smallest to largest and print top salary
And calculate the total salaries by this program

 ``123456789101112131415161718192021222324252627`` ``````#include struct employee { char name[20]; float salary; int birthday; char sex [6]; }; void main() { struct employee emp[25]; for(int i=0;i<25;i++) { cout<<"Enter the Employee name :"<>emp[i].name; cout<<"Enter the salary :"<>emp[i].salary; cout<<"Enter the birthday :"<>emp[i].birthday; cout<<"Enter the sex :"<>emp[i].sex; } for(i=0;i<25;i++) cout<<" the name is:" << emp[i].name<<" , "<<"salary is: "<
Last edited on
bubble sort get some temporary variable and from the a[i] every time check if its smaller than a next one. (bad english heres the example)

 ``12345678910111213141516`` ``````do { z=0; { for(i=0;i<25;i++) { if(a[i]

later you add birhtday name and sex...
I do not know how I apply this example

Can anyone help me
Last edited on
 ``1234567891011`` ``````float highest_salary = 0.0f; float total_salary = 0.0; for (unsigned i = 0; i < 25; ++i) { if (emp[i].salary > highest_salary); highest_salary = emp[i].salary; total_salary += emp[i].salary; } cout << "Total Salary: " << total_salary << endl; cout << "Highest Salary: " << highest_salary << endl;``````

That should help :)
thank you for help me

it gooooooooooood
Does anyone have any code to classify Salaries ascending or descending to this program
Topic archived. No new replies allowed.