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

This commit is contained in:
Pavlo Tverdyi 2020-04-16 19:22:15 +00:00
parent 7f4966f6fe
commit 73006062d7

View File

@ -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;
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<count;i++){
printf("Neprijati studenti:\n");
for(int i=places;i<count+1;i++){
if(list[i].num==0){
puts(list[i].fname);
fputs(list[i].fname,stdout);
k++;
}
}