Advertisement
STANAANDREY

3/155

Nov 5th, 2019
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. using namespace std;
  6.  
  7. typedef struct
  8. {
  9.     unsigned zi, luna, an;
  10. } datac;
  11.  
  12. typedef struct
  13. {
  14.     char nume[100];
  15.     datac datapers;
  16. } persoana;
  17.  
  18. int main()
  19. {
  20.     unsigned nrp = 10;
  21.     persoana p[10];
  22.     datac data;
  23.     cin >> data.zi >> data.luna >> data.an;
  24.     for (int i = 0; i < nrp; i++)
  25.     {
  26.         getchar();
  27.         gets(p[i].nume);
  28.         cin >> p[i].datapers.zi >> p[i].datapers.luna >> p[i].datapers.an;
  29.     }
  30.  
  31.     int zd = (data.an - 1) * 365 + (data.luna - 1) * 30 + data.zi;
  32.     for (int i = 0; i < nrp; i++)
  33.     {
  34.         int z;
  35.         z = (p[i].datapers.an - 1) * 365 + (p[i].datapers.luna - 1) *30 + p[i].datapers.zi;
  36.         if (z - zd >= 18 * 365)
  37.             puts(p[i].nume);
  38.     }
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement