因此,我們應該將453456秒轉換爲年,日,小時,分鐘和秒。我無法找到公式
但是,我似乎無法擺脫過去的歲月。
這是我到目前爲止有:
#include<iostream>
using namespace std;
int main(){
int secDis;
int years;
const int yearsSec = 31536000;
int days;
cout << "Please give me the time of travel in seconds.";
cin >> secDis;
years = secDis/yearsSec;
days = (yearsSec%secDis)/1440; /*idk if I am on the right track*/
cout << "You have been traveling for: "
<< years << days;
如果453456秒它應該是0年5月日14小時57分36秒。
//我討厭我的數學技能。
艱鉅的任務。一般來說,一年中有多少秒是不可能的。 – SergeyA
如果這是一項家庭作業任務,請考慮如果您從其他人那裏獲得解決方案,您將不會學習任何形式的任務。我建議你採取筆和紙,並試圖找出如何去做 – user463035818
這是一個基本的365天的一年。 – RexBruin17