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