1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#include <stdio.h>
#include <string.h>
#define Etudient struct Etudient
Etudient{
char Nom[20];
int NI;
char Groupe[2];
};
void permuter(char *a, char *b)
{
char tmp[20]={0};
strcpy(tmp,a);
strcpy(a,b);
strcpy(b,tmp);
}
void tri_croissant(Etudient *V, int n)
{
int i=0,j=0,k=1,a=0,b=0;
}
for(i=0;i<18;i++)
{
while(k<n)
{
for(j=0;j<n-k;j++)
{
a=V[j].Nom[i];
b=V[j+1].Nom[i];
if(a>b) permuter(&V[j].Nom[i],&V[j+1].Nom[i]);
}
k++;
}
}
}
suite du code.... |
Partager