Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include<conio.h>
- #include<stdlib.h>
- typedef struct abon
- { int num;
- char fio[20], pol[20];
- int voz, stag;
- }ABON;
- const int n=10;
- int i,k,j;
- int main()
- {
- setlocale(0,"rus");
- ABON z[n]={
- {1,"Анисимов Ю.П.","М",1940,1957},
- {2,"Иванов И.Н. ","М",1980,1999},
- {3,"Махова О.И. ","Ж",1960,1980},
- {4,"Огарев К.М. ","М",1971,1990},
- {5,"Егорова П.К. ","Ж",1993,2011},
- {6,"Голикова О.И.","Ж",1972,1990},
- {7,"Сотников Т.С.","М",1980,1999},
- {8,"Комов В.И. ","М",1979,2005},
- {9,"Лебедев А.А. ","М",1959,1981},
- {10,"Димова В.В. ","Ж",1991,2010},
- },y[n];
- ABON x;
- printf("--------------------------------------------\n");
- printf("| №| ФИО |Пол| Год рождения | Стаж |\n");
- printf("--------------------------------------------\n");
- for (i=0;i<n;i++)
- {printf("|%2d|%13s|%2s | %5d | %4d |\n",
- z[i].num,z[i].fio, z[i].pol, z[i].voz,z[i].stag);}
- printf("--------------------------------------------\n");
- for (i=0;i<n;i++)
- {
- if (z[i].pol[0]=='Ж')
- y[k++]=z[i];
- }
- for(i=1;i<k;i++)
- {
- for(j=k-1;j>=i;j--)
- {
- if(y[j].voz<y[j-1].voz)
- {
- x=y[j];
- y[j]=y[j-1];
- y[j-1]=x;
- }}}
- printf("По стажу\n");
- printf("--------------------------------------------\n");
- printf("| №| ФИО |Пол| Год рождения | Стаж |\n");
- printf("--------------------------------------------\n");
- for (i=0;i<k;i++)
- {
- printf("|%2d|%13s|%2s | %5d | %4d |\n",
- y[i].num,y[i].fio, y[i].pol, y[i].voz,y[i].stag);
- }
- printf("--------------------------------------------\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement