Изменить 'du5/program.c'

This commit is contained in:
Pavlo Tverdyi 2020-04-09 19:35:51 +00:00
parent 6edddf930a
commit 518f00f2ed

View File

@ -25,7 +25,6 @@ int count=keep(list);
int pult=del(list,count); int pult=del(list,count);
Sort_Num(list,count); Sort_Num(list,count);
Sort_Sname(list,count); Sort_Sname(list,count);
//Sort_Fname(list,count);
print(list,count); print(list,count);
return 0; return 0;
} }
@ -33,9 +32,10 @@ print(list,count);
int keep(struct LIS *list){ int keep(struct LIS *list){
int count; int count;
for(count=0;fscanf(stdin,"%d %s %s",&list[count].num, list[count].sname, list[count].fname)==3;count++){ for(count=0;fscanf(stdin,"%d %s %s",&list[count].num, list[count].sname, list[count].fname)==3;count++){
for(int i=0;list[count].fname[i]!='\0';i++); // for(int i=0;list[count].fname[i]!='\0';i++);
} }
return count; return count;
} }
int del(struct LIS *list,int count){ int del(struct LIS *list,int count){
@ -86,12 +86,17 @@ void Sort_Sname(struct LIS *list,int count){//Selection Sort
void print(struct LIS *list,int count){ void print(struct LIS *list,int count){
if(count!=0){
printf("Vysledky:\n"); printf("Vysledky:\n");
for(int i=0;i<count;i++){ for(int i=0;i<count;i++){
if(list[i].num!=0){ if(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);
} }
} }
}
else{
printf("Nepodarilo nacitat nic");
}
} }