Изменить 'du5/program.c'
This commit is contained in:
		
							parent
							
								
									f736bb989b
								
							
						
					
					
						commit
						3f0adf5b6f
					
				| @ -64,26 +64,22 @@ void Sort_Num(struct LIS *list,int count){//bubble sort :) | ||||
| } | ||||
| void Sort_Sname(struct LIS *list,int count){ | ||||
|     struct LIS ilusion; | ||||
|     for(int i=0;i<count;i++){ | ||||
|         for(int j=count;j>i;j--){ | ||||
|             if(list[i].num==list[j].num && strcmp(list[i].sname,list[j].sname)==0){ | ||||
|                 for(int k=0;k<strlen(list[i].sname);k++){ | ||||
|                     if(list[i].sname[k]<list[j].sname[k]){ | ||||
|                         ilusion=list[i]; | ||||
|                         list[i]=list[j]; | ||||
|                         list[j]=ilusion; | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|     for(int i=count-1;i<0;i--){ | ||||
|         for(int j=0;j<i;j++){ | ||||
|             if(list[j].num==list[j+1].num && strcmp(list[j].sname,list[j+1].sname)>0 ){ | ||||
|                 ilusion=list[j]; | ||||
|                 list[j]=list[j+1]; | ||||
|                 list[j+1]=ilusion; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void print(struct LIS *list,int pult){ | ||||
|     printf("Vysledky:\n"); | ||||
|     for(int i=0;i<pult;i++){ | ||||
|         if(list[i].num!=-1 && list[i].num!=0){ | ||||
|         printf("%d %s %s\n",list[i].num, list[i].sname, list[i].fname); | ||||
|             printf("%d %s %s\n",list[i].num, list[i].sname, list[i].fname); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user