Изменить 'du6/program.c'
This commit is contained in:
parent
3e22a0af47
commit
2fcfe5ff2c
@ -34,25 +34,26 @@ 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);count++){
|
for(;fgets(names,100,stdin);){
|
||||||
if(sscanf(names,"%s %s",list[count].fname,list[count].name)==2){
|
if(sscanf(names,"%s %s",list[count].fname,list[count].name)==2){
|
||||||
|
count++;
|
||||||
if(places>=count){
|
if(places>=count){
|
||||||
list[count].num=0;
|
list[count-1].num=0;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
list[count].num=1;
|
list[count-1].num=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(sscanf(names,"%s",list[count].fname)==1){
|
else if(sscanf(names,"%s",list[count].fname)==1){
|
||||||
|
count++;
|
||||||
if(places>=count){
|
if(places>=count){
|
||||||
list[count].num=2;
|
list[count-1].num=2;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
list[count].num=3;
|
list[count-1].num=3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count--;
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ void sort(struct LIS* list,int count){
|
|||||||
struct LIS ilusion;
|
struct LIS ilusion;
|
||||||
char *min;
|
char *min;
|
||||||
int mini;
|
int mini;
|
||||||
for(int i=0;i<count;i++){
|
for(int i=0;i<count-1;i++){
|
||||||
min=list[i].fname;
|
min=list[i].fname;
|
||||||
mini=i;
|
mini=i;
|
||||||
for(int j=i+1;j<=count;j++){
|
for(int j=i+1;j<=count;j++){
|
||||||
|
Loading…
Reference in New Issue
Block a user