Working with years in data struct

Hi.
I have a problem to solve this condition :
In a struct data are known the registration number of the person(consisting of 5 digits), the year, the day, and month of birth. We also know the number of people wich is n, the current month and day(wich are outside the struct). We should output the people that celebrated their birthday this year.
I want to know how to compare the years and how to work with them without any functions.
Here is a attempt but i doubt it could help :
 ``12345678910111213141516171819202122232425262728293031323334`` ``````#include #include #include using namespace std; struct elevi { int registrationNR; int year; int month; int day; }V[99]; int main(){ int n,currentmonth,currentday; int i; int compday,compmonth,compyear; cin>>n>>currentday>>currentmonth; //nr de elevi int currentmonth1 = currentmonth * 30; for(i=0;i>V[i].registrationNR>>V[i].day>>V[i].month>>V[i].year; compday = V[i].day * 1; compmonth = V[i].month * 30; compyear= V[i].year * 365; if(compday < currentday && compmonth < currentmonth1 && compyear< 737665)//wich is 2021 * 365 { cout<< V[i].registrationNR<< " "; } } }``````

Last edited on
If you know the current month and day, then people who have celebrated their birthday have:

Birth months previous to the current month

OR

Birth months that are the same as the current month AND birth day-of-month the same as or previous to the current day-of-month.
can you show me an little example?
 ``1234567`` ``````if ((birthMonth < currentMonth) || ((birthMonth == currentMonth) && (birthDayOfMonth <= currentDayOfMonth)) { // the person already celebrated a birthday this year // do whatever needs to be done }``````

Beyond this help, I would be doing your homework for you.
 doug4
thanks