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.с++​

Ответы

Ответ дал: fedrfedr
4

Ответ:

#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";

}


anel356: спасибо❤
fedrfedr: Why is the question in English if you know Russian?
anel356: we will have basic programming in English
anel356: help me again?
anel356: please
fedrfedr: already done
anel356: Thanks you❤
Вас заинтересует