From aa41241df07e63e51f7354bc1e805a6e55f03012 Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Thu, 9 Apr 2020 19:48:02 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'du5/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du5/program.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 1 deletion(-) 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