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

This commit is contained in:
Pavlo Tverdyi 2020-04-16 13:51:03 +00:00
parent 8fe601683c
commit 4ed18d0add

View File

@ -25,7 +25,6 @@ if(k!=1 || places<0){
else{ else{
int count=keep(list,places); int count=keep(list,places);
sort(list,count); sort(list,count);
printf("%d",count);
print(list,count,places); print(list,count,places);
} }
return 0; return 0;
@ -53,6 +52,7 @@ char names[100];
} }
} }
} }
count--;
return count; return count;
} }
@ -79,8 +79,8 @@ void sort(struct LIS* list,int count){
void print(struct LIS *list,int count,int places){ void print(struct LIS *list,int count,int places){
if(count>0){ if(count>0){
if(places>0){ if(places>0){
puts("Prijati studenti:"); printf("Prijati studenti:\n");
for(int i=0;i<=count;i++){ for(int i=1;i<=count;i++){
if(list[i].num==2){ if(list[i].num==2){
printf("%s\n",list[i].fname); printf("%s\n",list[i].fname);
} }
@ -91,7 +91,7 @@ void print(struct LIS *list,int count,int places){
} }
if(count-places>0){ if(count-places>0){
printf("Neprijati studenti:\n"); printf("Neprijati studenti:\n");
for(int i=0;i<=count;i++){ for(int i=1;i<=count;i++){
if(list[i].num==3){ if(list[i].num==3){
printf("%s\n",list[i].fname); printf("%s\n",list[i].fname);
} }