Как сделать, чтобы при вводе данных "31 февраля" выдало "Неизвестная операция"? С++
// 2.cpp: определяет точку входа для консольного приложения.
#include "stdafx.h"
#include
using namespace std;


int main()
{
int month, day;
cout << "Programma opredeleniya znaka zodiaka" << endl;
cout << "Vvedite mecyac:";
cin >> month;
cout << "Vvedite den: ";
cin >> day;
switch (month)
{
case 1:
if (day <21)
cout << "Kozerog" << endl;
else cout << "Vodoley" << endl;
break;
case 2:
if (day <19)
cout << "Vodoley" << endl;
else cout << "Ryby" << endl;
break;
case 3:
if (day <21)
cout << "Ryby" << endl;
else cout << "Oven" << endl;
break;
case 4:
if (day <20)
cout << "Oven" << endl;
else cout << "Telec" << endl;
break;
case 5:
if (day <21)
cout << "Telec" << endl;
else cout << "Bliznecy" << endl;
break;
case 6:
if (day <22)
cout << "Bliznecy" << endl;
else cout << "Rak" << endl;
break;
case 7:
if (day <23)
cout << "Rak" << endl;
else cout << "Lev" << endl;
break;
case 8:
if (day <23)
cout << "Lev" << endl;
else cout << "Deva" << endl;
break;
case 9:
if (day <23)
cout << "Deva" << endl;
else cout << "Vesy" << endl;
break;
case 10:
if (day <23)
cout << "Vesy" << endl;
else cout << "Skorpion" << endl;
break;
case 11:
if (day <23)
cout << "Skorpion" << endl;
else cout << "Strelec" << endl;
break;
case 12:
if (day <22)
cout << "Strelec" << endl;
else cout << "Kozerog" << endl;
default: cout << "Neizvestnaya operaciya"< }

system("pause");
return 0;
}
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.