Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- struct human {
- char name[50];
- char lastName[50];
- int birthDate;
- };
- int main() {
- struct human humList1[4], humList2[4], humListTemp[4];
- for (int i = 0; i < 4; i++) {
- printf(" Vvedite imya %d human\n", i + 1);
- scanf("%s", humList1[i].name);
- printf("\n Vvedite familiu %d human\n", i + 1);
- scanf("%s", humList1[i].lastName);
- printf("\n Vvedite vozrast %d human\n", i + 1);
- scanf("%d", &humList1[i].birthDate);
- }
- for (int i = 0; i < 4; i++) {
- for (int j = 3; j >= (i + 1); j--) {
- if (humList1[j].birthDate < humList1[j - 1].birthDate) {
- humListTemp[i] = humList1[j];
- humList1[j] = humList1[j - 1];
- humList1[j - 1] = humListTemp[i];
- }
- }
- humList2[i] = humList1[i];
- printf("%s %s %d\n", humList2[i].name, humList2[i].lastName, humList2[i].birthDate);
- }
- getchar(); getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement