Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <stdio.h>
- using namespace std;
- typedef struct
- {
- int zi, l, an;
- } DATA;
- typedef struct
- {
- char nume[20];
- DATA d;
- } PERS;
- int main()
- {
- int x;
- PERS p[100];
- int n;
- cout << "x=";
- cin >> x;
- cout << "n=";
- cin >> n;
- cout << "Lista persoane:" << endl;
- for (int i = 0; i < n;i++)
- {
- gets(p[i].nume);
- cin >> p[i].d.zi >> p[i].d.l >> p[i].d.an;
- }
- DATA dc;
- cout << "data curenta:";
- cin >> dc.zi >> dc.l >> dc.an;
- for (int i = 0; i < n; i++)
- {
- int ani = dc.an - p[i].d.an;
- if (p[i].d.l > dc.l)
- ani--;
- else if (p[i].d.l == dc.l && p[i].d.zi > dc.zi)
- ani--;
- if (x == ani)
- cout << p[i].nume << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement