0

How to set month and day limits in calculator with iF statment?

I created a calculator to produce your birthday as of today. However, I am trying to set limits based on month and days. For example if June 31st was entered the program would recognize it is not correct as that date does not exist. When i wrote the if statements, only my first IF statement for January and the last one for December works. Please if you can look through the program and let me know what I am missing. the code is below (too long to paste): https://code.sololearn.com/cnpuHannX1Gr/#cpp

26th May 2018, 6:24 PM
shamizzle
1 Respuesta
0
June 31 is working because the condition you put for birthday in june(6th month) is ">31" it should have been either >=31 or >30 as june has 30 days . Just either put an eqaulity(=) or change days. Similar error is in feb too , maximum days for feb are 28 or 29(depending on leap year u need to put a leap year checker there) and for other months too .
31st May 2018, 8:17 AM
Ishan
Ishan - avatar