#include <iostream>
using namespace std;
const int capacity = 20;
string tax_payers[capacity] = {"jane", "tom", "jerry", "joe", "annie", "mary", "kate", "steve", "sarah", "paul", "petra", "peter","elaine", "noreen", "sean", "niamh", "donal", "john", "marie", "colin"};
double income[capacity] = {21000.0, 16500.0, 120000.0, 16000.0, 38000.0, 62500.0, 14500.0, 28500.0, 13500.0, 27500.0, 15000.0, 44000.0, 18000.0, 21000.0, 150000.0, 15500.0, 40000.0, 21000.0, 25000.0, 37500.0};
void swap(int &j, int &k);
int spaces = 25;
int main()
{

    cout << "\t" << "Sorted list" << endl;

    for (int j = 0; j <  capacity-1; j++)
    for(int  i = 0; i <  capacity-1; i++)
    {
   		if (income[i] < income[i+1])
   		   swap(income[i],income[i+1]);
    }
        
    for(int  i = 0; i < capacity; i++)
    cout << "\t" << tax_payers[i] <<" " << "\t" << income[i] << endl;;

    cout << "\n";
    
    cout << "\t" << "Under 25000"<< endl;
	
	for(int i=0;i<capacity;i++)
	{
		if(income[i] < 25000)
		cout << "\t"<< tax_payers[i] << "\n ";
	
	}
	
	cout << "\n";
	
    cout << "\t" << "Over 25000" << endl;
	
	for(int i=0;i<capacity;i++)
	{
		if(income[i] > 25000)
		cout << "\t" << tax_payers[i] << "\n ";
	
	}
return 0;

}

void swap( int &j, int &k )
 {
    int tmp = j;
    j = k;
    k = tmp;
 }

Sorry bout early post, went wrong my bad. I jst need help to assign the right tax payer and income to the right person for example sean shud b 150000 and not jane, she shud b assigned 21000. Any ideas why it is doin that??

Ya i understand what you are sayin, but i tried this
V
if (tax_payers < tax_payers[i+1])
swap(tax_payers,tax_payers[i+1]);
after the first if statement but still doesn't assignin them right, did i set up the parallel arrays wrong or something??

I haven't read all of your code because it is hard to read wihtout code tag. However, I think your sort should be in this way:

string temp;

for (int j = 0; j < capacity-1; j++) {
  for(int i = 0; i < capacity-1; i++) {
     if (income[i] < income[i+1]) {
         swap(income[i],income[i+1]);
         temp = tax_payers[i];
         tax_payers[i] = tax_payers[i+1];
         tax_payers[i+1] = temp;
     }
  }
}

When you sort your income array, the oringinal order of income will probally be changed. To keep it parrallel to the tax payers, you need to change the tax payers order too.

This question has already been answered. Start a new discussion instead.