/** title: Bubble-Sort em C (aula T) ficheiro: ex7c.c autor: PRH versao de: 2001.03.22 .uso de arrays emparelhados .ordenacao por trocas com paragem logo que nao haja alteracoes **/ #include #include #define bool int #define true 1 #define false 0 #define MAX 10 #define troca strcpy(sigla,pals[j]); strcpy(pals[j],pals[j-1]); strcpy(pals[j-1],sigla); aux=cambio[j]; cambio[j]=cambio[j-1]; cambio[j-1]=aux typedef char str[20]; /*----- programa principal -----*/ int main( ) { int i, j, ult, max=0; float aux, cambio[MAX]; str sigla, pals[MAX]; bool hatrocas; while ((maxi; j--) { if (strcmp(pals[j],pals[j-1])<0) { hatrocas=true; troca; } } i++; } printf("%d\n",i); for ( i=0; i %f \n",pals[i],cambio[i]); } return( 0 ); }