#include <iostream>
using namespace std;
int main()
{
int month, holidays;
cout << "Введите номер месяца: ";
cin >> month;
switch (month) {
case 1:
holidays = 3;
break;
case 2:
holidays = 0;
case 3:
holidays = 1;
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
holidays = 2;
default:
cout << "Некорректный номер месяца!" << endl;
return 1;
}
cout << "Количество праздничных дней в " << month << "-м месяце: " << holidays << endl;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
int main()
{
int month, holidays;
cout << "Введите номер месяца: ";
cin >> month;
switch (month) {
case 1:
holidays = 3;
break;
case 2:
holidays = 0;
break;
case 3:
holidays = 1;
break;
case 4:
holidays = 0;
break;
case 5:
holidays = 3;
break;
case 6:
holidays = 1;
break;
case 7:
holidays = 0;
break;
case 8:
holidays = 0;
break;
case 9:
holidays = 0;
break;
case 10:
holidays = 0;
break;
case 11:
holidays = 1;
break;
case 12:
holidays = 2;
break;
default:
cout << "Некорректный номер месяца!" << endl;
return 1;
}
cout << "Количество праздничных дней в " << month << "-м месяце: " << holidays << endl;
return 0;
}