Ответ:
#include <iostream>
using namespace std;
int main()
{
int a, b, c, febrary;
bool isValid;
//setlocale(LC_ALL, "Russian");
cout << "Day:";
cin >> a;
cout << "Month:";
cin >> b;
cout << "Year:";
cin >> c;
if (c % 4 == 0)
febrary = 29;
else
febrary = 28;
isValid = true;
if (b < 1 || b > 12)
isValid = false;
if (a < 1 || b > 31)
if (b == 4 || b == 6 || b == 9 || b == 11)
if (b == 2 && a > febrary)
if (isValid)
cout << "yes";
cout << "no";
}
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
Ответ:
#include <iostream>
using namespace std;
int main()
{
int a, b, c, febrary;
bool isValid;
//setlocale(LC_ALL, "Russian");
cout << "Day:";
cin >> a;
cout << "Month:";
cin >> b;
cout << "Year:";
cin >> c;
if (c % 4 == 0)
febrary = 29;
else
febrary = 28;
isValid = true;
if (b < 1 || b > 12)
isValid = false;
if (a < 1 || b > 31)
isValid = false;
if (b == 4 || b == 6 || b == 9 || b == 11)
isValid = false;
if (b == 2 && a > febrary)
isValid = false;
if (isValid)
cout << "yes";
else
cout << "no";
}