第四题:
#include <iostream>
using namespace std;
int main()
{
long time;
cout << "Enter the number of seconds: ";
cin >> time;
long seconds = time % 60;
long minutes = time/60;
long hours = minutes/60;
minutes = minutes%60;
long days = hours/24;
hours = hours%24;
cout << time << " seconds = "
<< days << " days, "
<< hours << " hours, "
<< minutes << " minutes, "
<< seconds << " seconds "
<< endl;
return 0;
}
网友评论