I am having trouble on my sort. I am trying to sort First and Last Name (in ABC order), and for every name there is the age, city, state, etc.. Obviously when I sort the Names, I have to get the age, city, state, etc.. to go along with it. I have managed to get age and zipcode to switch along with the names, but I dont know how to change the city to go along with the name because it is a char. How would I do this?
I know my code is really rough, and there are better ways to do the whole code, but what is the most simplest way possible to get the city to change along with the First and Last name? Thanks!
This is the WHOLE Code:
http://rafb.net/p/1uDyjo27.html
This is the section I am working on now:
Code:
void searchfull()
{
int j;
char tempf[25][25],templ[25][25],tempr[25][25],tempq[25][25];
int tempn[25],tempx[25];
for (j=1; j<=u-1; j++)
{
for (I=1; I<=u-1; I++)
{ namecmp=strcmpi(namel[I], namel[I+1]);
if(namecmp > 0)
{
strcpy(tempf[I],namef[I]);
strcpy(templ[I],namel[I]);
strcpy(tempr[I],city[I]);
tempn[I]=zipcode[I];
tempx[I]=age[I];
strcpy(namef[I], namef[I+1]);
strcpy(namel[I], namel[I+1]);
strcpy(city[I], city[I+1]);
zipcode[I]=zipcode[I+1];
age[I]=age[I+1];
strcpy(namef[I+1],tempf[I]);
strcpy(namel[I+1],templ[I]);
strcpy(city[I], tempr[I+1]);
zipcode[I+1]=tempn[I];
age[I+1]=tempx[I];
}
else if(namecmp==0)
{
namecmp=strcmpi(namef[I], namef[I+1]);
if(namecmp> 0)
{
strcpy(tempf[I],namef[I]);
strcpy(tempr[I],city[I]);
strcpy(templ[I],namel[I]);
tempn[I]=zipcode[I];
tempx[I]=age[I];
strcpy(namef[I], namef[I+1]);
strcpy(namel[I], namel[I+1]);
strcpy(city[I],city[I]);
zipcode[I]=zipcode[I+1];
age[I]=age[I+1];
strcpy(namef[I+1],tempf[I]);
strcpy(namel[I+1],templ[I]);
strcpy(city[I],tempr[I]);
zipcode[I+1]=tempn[I];
age[I+1]=tempx[I];
}
}
}
}
If you want to talk to me one on one, I am available on AIM at Chronotrigga05 right now . Or you can reply down here, Ill reply back.