sorting

This is a discussion on sorting within the C++ Programming forums, part of the General Programming Boards category; having trouble sorting employees pay Code: #include <iostream.h> void main() { // declare variables char nam[30]; float sale; float total; ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    54

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

  2. #2
    Veni Vidi Vice
    Join Date
    Aug 2001
    Posts
    343
    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.

  3. #3
    Shadow12345
    Guest
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with linked list sorting function
    By Jaggid1x in forum C Programming
    Replies: 6
    Last Post: 06-02-2009, 03:14 AM
  2. sorting structure members using pointers
    By robstr12 in forum C Programming
    Replies: 5
    Last Post: 07-25-2005, 06:50 PM
  3. Sorting words with a fast, effincient sorting method
    By Unregistered in forum C++ Programming
    Replies: 19
    Last Post: 07-12-2002, 05:21 PM
  4. Still Needing Help : selection sorting
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 10-14-2001, 09:41 PM
  5. selection sorting
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 10-13-2001, 09:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21