0

Correct date (please help) c++

Given three natural numbers a, b, c which represent the day, month and year of some date. Output “yes" if the given date is correct and “no” otherwise. Example: Input: 32 1 1991 Output no What is wrong? #include <iostream> using namespace std ; int main() { int day, month, year; cin >> day >> month >>year; if(month > 12) cout << "no"; if(!(month%2)) { if(day > 30) cout<< "no"; } else if(day > 31) cout << "no"; if(month == 2) { if(year%4) { if(day > 28) cout << "no"; } else if(day > 29) cout << "no"; } else { cout <<"Yes";} return 0; }

19th Sep 2020, 6:26 AM
Azat Malgazhdar
Azat Malgazhdar - avatar
1 Antwort
0
15th Sep 2022, 8:02 PM
비누