diff --git a/du6/program.c b/du6/program.c index e127cb4..b0cfa1b 100644 --- a/du6/program.c +++ b/du6/program.c @@ -35,7 +35,10 @@ char keep(struct LIS* list,int places){ int count=0; char names[100]; for(;fgets(names,100,stdin);){ - if(names[0]=='\n') continue; + if(names[0]=='\n'){ + list[count].num=-1; + continue; + } if(sscanf(names,"%s %s",list[count].fname,list[count].name)==2){ count++; if(places>=count){ @@ -83,10 +86,6 @@ void print(struct LIS *list,int count,int places){ if(places>0){ printf("Prijati studenti:\n"); int i=1; - if(count==1){ - i=0; - count--; - } for(i;i<=count;i++){ if(list[i].num==2 && list[i].fname[0]!='\n'){ printf("%s\n",list[i].fname); @@ -111,4 +110,18 @@ void print(struct LIS *list,int count,int places){ else{ puts("Ziadne prihlasky"); } -} \ No newline at end of file +} + + + + + + + + + + + + + + \ No newline at end of file