Лингвистика - влияние первого языка на изучении второго — страница 8

  • Просмотров 2891
  • Скачиваний 364
  • Размер файла 13
    Кб

n=strlen((*temp).fam)+strlen((*temp).name)+strlen((*temp).fanem); printf("\n%s %s %s ",(*temp).fam,(*temp).name,(*temp).fanem); i=1; while (i<39-n) { printf(" "); i++; } printf("%s ",(*temp).b_day); printf("%s ",(*temp).b_manth); printf("%s ",(*temp).b_year); n=n+i+strlen((*temp).b_day)+strlen((*temp).b_manth)+strlen((*temp).b_year); i=1; while (i<61-n) { printf(" "); i++; } printf("%s",(*temp).zodiak); temp=(*temp).next; } while (temp!=NULL); } scanf("%s"); } /*************************************************************/ void Sortir ( ) { struct inform *tmp; int m; clrscr(); if (first!=NULL) { m=1; while(m==1) { m=0; temp=first; while((*temp).next!=NULL) {

if((strcmp((*temp).fam,(*(*temp).next).fam)>0) || (strcmp((*temp).fam,(*(*temp).next).fam)==0) && (strcmp((*temp).name,(*(*temp).next).name)>0) || (strcmp((*temp).fam,(*(*temp).next).fam)==0) && (strcmp((*temp).name,(*(*temp).next).name)==0) && (strcmp((*temp).fanem,(*(*temp).next).fanem)>0)) { m=1; if (temp==first) first=(*temp).next; else (*(*temp).prev).next=(*temp).next; if ((*temp).next==cut) { cut=temp; tmp=NULL; } else { (*(*(*temp).next).next).prev=temp; tmp=(*(*temp).next).next; } (*(*temp).next).next=temp; (*(*temp).next).prev=(*temp).prev; (*temp).prev=(*temp).next; (*temp).next=tmp; } else temp=(*temp).next; } m=0; temp=cut; while((*temp).prev!=NULL) { if((strcmp((*temp).fam,(*(*temp).prev).fam)<0) ||

(strcmp((*temp).fam,(*(*temp).prev).fam)==0) && (strcmp((*temp).name,(*(*temp).prev).name)<0) || (strcmp((*temp).fam,(*(*temp).prev).fam)==0) && (strcmp((*temp).name,(*(*temp).prev).name)==0) && (strcmp((*temp).fanem,(*(*temp).prev).fanem)<0)) { m=1; if (temp==cut) cut=(*temp).prev; else (*(*temp).next).prev=(*temp).prev; if ((*temp).prev==first) { first=temp; tmp=NULL; } else { (*(*(*temp).prev).prev).next=temp; tmp=(*(*temp).prev).prev; } (*(*temp).prev).prev=temp; (*(*temp).prev).next=(*temp).next; (*temp).next=(*temp).prev; (*temp).prev=tmp; } else temp=(*temp).prev; } } } else printf("Таблица пуста"); scanf("%s"); } /*************************************************************/ void main() { char ch; first=NULL;

do { clrscr(); printf("Выберте действие\n1-Добавить\n2-Удалить\n"); printf("3-Просмотреть\n4-Сортировать\n0-Выход"); scanf("%d",&ch); switch(ch) { case 1:Dobav();break; case 2:Udal();break; case 3:Prosm();break; case 4:Sortir();break; } } while(ch); }