sorting

• 12-28-2002
sonict
sorting
having trouble sorting employees pay
Code:

```#include <iostream.h> void main() {         // declare variables         char nam[30];         float sale;         float total;         int weekpay = 200;         int i = 1;         int hold;         // for loop and input names & determine wages         cout << "Input 10 employees. " << endl;         for (i>=1; i<=10; i++)         {                 cout << "Enter name of worker : ";                 cin  >> nam;                 cout << "Enter number of sales : ";                 cin  >> sale;                 total = ((sale * 0.09) + weekpay);                 cout << "This employees pay is \$ " << total << endl;         }                 // sort pay rates                         cout << nam << endl;         cin >> hold;                } #include <iostream.h> void main() {         // declare variables         char nam[30];         float sale;         float total;         int weekpay = 200;         int i = 1;         int hold;         // for loop and input names & determine wages         cout << "Input 10 employees. " << endl;         for (i>=1; i<=10; i++)         {                 cout << "Enter name of worker : ";                 cin  >> nam;                 cout << "Enter number of sales : ";                 cin  >> sale;                 total = ((sale * 0.09) + weekpay);                 cout << "This employees pay is \$ " << total << endl;         }                 // sort pay rates                         cout << nam << endl;         cin >> hold;                }```
• 12-28-2002
ripper079
Quote:

having trouble sorting employees pay
Well I havenīt seen any code for it. If you post some code it will certainly be easier for us to help you.

P.S. Donīt use void main.
• 12-28-2002
Quote:

int i = 1;
int hold;

// for loop and input names & determine wages
cout << "Input 10 employees. " << endl;
for (i>=1; i<=10; i++)
{
cout << "Enter name of worker : ";
cin >> nam;
cout << "Enter number of sales : ";
cin >> sale;
total = ((sale * 0.09) + weekpay);
cout << "This employees pay is \$ " << total << endl;
}

should be
Code:

```        int i;         int hold;         // for loop and input names & determine wages         cout << "Input 10 employees. " << endl;         for (i = 1; i<=10; i++)         {                 cout << "Enter name of worker : ";                 cin  >> nam;                 cout << "Enter number of sales : ";                 cin  >> sale;                 total = ((sale * 0.09) + weekpay);                 cout << "This employees pay is \$ " << total << endl;         }```
and everyone here is going to tell you not to use void main