diff --git a/du5/program.c b/du5/program.c index 64e3695..9b7ccd0 100644 --- a/du5/program.c +++ b/du5/program.c @@ -1 +1,107 @@ -фы \ No newline at end of file +#include +#include +#include +#include + + +struct LIS{ + +char fname[100]; +char sname[100]; +int num; +}; + +int keep(struct LIS *); +int del(struct LIS *,int); +void Sort_Num(struct LIS *,int); +void Sort_Sname(struct LIS *,int); +//void Sort_Fname(struct LIS *,int); +void print(struct LIS *,int); + + +int main(){ +struct LIS list[100]; +int count=keep(list); +int pult=del(list,count); +Sort_Num(list,count); +Sort_Sname(list,count); +print(list,count); + return 0; +} + +int keep(struct LIS *list){ + int count; + for(count=0;fscanf(stdin,"%d %s %s",&list[count].num, list[count].sname, list[count].fname)==3;count++){ +// for(int i=0;list[count].fname[i]!='\0';i++); + } + return count; + +} + +int del(struct LIS *list,int count){ + int kount=count; + for(int i=0;ii;j--){ + if(list[i].num0){ + min=list[j].sname; + mini=j; + } + } + ilusion=list[i]; + list[i]=list[mini]; + list[mini]=ilusion; + } +} + + +void print(struct LIS *list,int count){ + if(count!=0){ + printf("Vysledky:\n"); + for(int i=0;i