Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct{
- char *cognome,data[10+1],*nome;
- }Anagrafica;
- typedef struct{
- Anagrafica anagrafica;
- char *categoria,codice_atleta[5+1];
- int ore;
- }Atleti;
- typedef struct nodo *link;
- struct nodo{
- Atleti atleti;
- link next;
- };
- void ordinamento_per_categoria(link head_atleti)
- {
- link tmp,tmp_prev,x;
- for(tmp=head_atleti->next,head_atleti->next=NULL;tmp!=NULL;tmp=tmp_prev){
- tmp_prev=tmp->next;
- if(stricmp(head_atleti->atleti.categoria,tmp->atleti.categoria)>0){
- tmp->next=head_atleti;
- head_atleti=tmp;
- }else{
- for(x=head_atleti;x->next!=NULL;x=x->next){
- if(stricmp(x->atleti.categoria,tmp->atleti.categoria)>0){
- break;
- }
- }
- tmp->next=x->next;
- x->next=tmp;
- }
- }
- }
- INPUT:
- A0001 Rossi Francesco ACRO_12_18 10/07/2000 12
- A0002 Verdi Marco GAM_L4 02/12/1999 11
- A0003 Bianchi Valeria GAF_GOLD 20/02/1997 16
- A0004 Neri Andrea GAM_OPEN 21/06/1995 13
- A0005 Verdi Sara ACRO_12_18 11/12/2003 10
- A0006 Rossi Antonio GAM_L2 11/12/2008 5
- A0007 Milano Simone ACRO_12_18 12/11/2003 8
- A0008 Rossi Valentina ACRO_12_18 11/12/2003 10
- A0009 Pavlov Nikolai GAM_L4 20/06/1999 12
- A0010 Verdi Samanta GAF_GOLD 01/04/1996 16
- OUTPUT:
- ACRO_12_18 A0001 Francesco Rossi 10/07/2000 12
- GAM_L4 A0002 Marco Verdi 02/12/1999 11
- GAF_GOLD A0010 Samanta Verdi 01/04/1996 16
- ACRO_12_18 A0008 Valentina Rossi 11/12/2003 10
- ACRO_12_18 A0007 Simone Milano 12/11/2003 8
- GAM_L2 A0006 Antonio Rossi 11/12/2008 5
- ACRO_12_18 A0005 Sara Verdi 11/12/2003 10
- GAF_GOLD A0003 Valeria Bianchi 20/02/1997 16
- GAM_OPEN A0004 Andrea Neri 21/06/1995 13
- GAM_L4 A0009 Nikolai Pavlov 20/06/1999 12
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement