diff --git a/du6/program.c b/du6/program.c index f66c470..65b50d6 100644 --- a/du6/program.c +++ b/du6/program.c @@ -33,13 +33,14 @@ else{ char keep(struct LIS* list,int places){ int count=0; char names[100]; - for(;fgets(list[count].fname,100,stdin);count++){ + for(;fgets(list[count].fname,100,stdin);){ if(list[count].fname[0]=='\n'){ list[count].num=-1; // printf("skip"); } if(list[count].fname[0]!='\n'){ - list[count].num=0; + list[count].num=0; + count++; } } return count; @@ -71,20 +72,20 @@ void print(struct LIS *list,int count,int places){ if(count>0){ if(places>0){ int k=0; - puts("Prijati studenti:"); + printf("Prijati studenti:\n"); for(int i=0;k!=places+1;i++){ if(list[i].num==0){ - puts(list[i].fname); + fputs(list[i].fname,stdout); k++; } } } if(count-places>0){ int k=0; - puts("Neprijati studenti:"); - for(int i=places+1;i