Пожалуйста помогите!!!! ввести номер месяца и номер дня вывести число дней оставшихся до нового года
(номер месяц. 12
день 25)
Ответы
Ответ дал:
0
#include <iostream>
using namespace std;
int main()
{
int month, day, total_days;
int days_per_month[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
cout << "nEnter month (1 to 12): ";
cin >> month;
cout << "Enter day (1 to 31): ";
cin >> day;
total_days = day;
for(int j=0; j<month-1; j++)
total_days += days_per_month[j];
cout << "Total days from start of year is: " << total_days << endl;
cin.get();
cin.get();
return 0;
}
using namespace std;
int main()
{
int month, day, total_days;
int days_per_month[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
cout << "nEnter month (1 to 12): ";
cin >> month;
cout << "Enter day (1 to 31): ";
cin >> day;
total_days = day;
for(int j=0; j<month-1; j++)
total_days += days_per_month[j];
cout << "Total days from start of year is: " << total_days << endl;
cin.get();
cin.get();
return 0;
}
Вас заинтересует
2 года назад
2 года назад
8 лет назад
8 лет назад
10 лет назад
10 лет назад