编写一个 C++ 程序,通过示例将天转换为年和周。此 C++ 程序允许用户输入总天数,并将其转换为年和周。
#include<iostream>
using namespace std;
int main()
{
int numOfDays, years, weeks;
cout << "\nPlease Enter the Number of Days = ";
cin >> numOfDays;
years = numOfDays / 365;
weeks = (numOfDays % 365) / 7;
cout << "\nYears = " << years;
cout << "\nWeeks = " << weeks;
return 0;
}
