# include & ltiostream & gt
# include & ltctime & gt
使用命名空間std
int main()
{
int total seconds = time(0);
int current second = total seconds % 60;
int總分鐘數=總秒鐘數/60;
int current minute = total minutes % 60;
int total hours = total minutes/60;
int current hour =(int)(total hours % 24);
cout & lt& lt"當前時間是"
返回0;
}
Time(0)是從時間開始到當前時間經過的秒數。
對於短周期for(int I = 0;我& lt1000;我++)這個我也不記得了。循環壹千次需要多長時間?自己檢查編程。我想通了。盡最大努力。