Изменить 'du6/program.c'
This commit is contained in:
parent
689ff76ea5
commit
8fe601683c
@ -25,6 +25,7 @@ if(k!=1 || places<0){
|
||||
else{
|
||||
int count=keep(list,places);
|
||||
sort(list,count);
|
||||
printf("%d",count);
|
||||
print(list,count,places);
|
||||
}
|
||||
return 0;
|
||||
@ -34,7 +35,7 @@ else{
|
||||
char keep(struct LIS* list,int places){
|
||||
int count=0;
|
||||
char names[100];
|
||||
for(;fgets(names,100,stdin);){
|
||||
for(;fgets(names,100,stdin);count++){
|
||||
if(sscanf(names,"%s %s",list[count].fname,list[count].name)==2){
|
||||
if(places>=count){
|
||||
list[count].num=0;
|
||||
@ -42,7 +43,6 @@ char names[100];
|
||||
else{
|
||||
list[count].num=1;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
else if(sscanf(names,"%s",list[count].fname)==1){
|
||||
if(places>=count){
|
||||
@ -51,7 +51,6 @@ char names[100];
|
||||
else{
|
||||
list[count].num=3;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
@ -80,7 +79,7 @@ void sort(struct LIS* list,int count){
|
||||
void print(struct LIS *list,int count,int places){
|
||||
if(count>0){
|
||||
if(places>0){
|
||||
printf("Prijati studenti:");
|
||||
puts("Prijati studenti:");
|
||||
for(int i=0;i<=count;i++){
|
||||
if(list[i].num==2){
|
||||
printf("%s\n",list[i].fname);
|
||||
|
Loading…
Reference in New Issue
Block a user