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; }
2 ответов
0