标签:++ 注意 font main 图片 code span img math
1025得好好想想,打算再看一遍数组再写
1 #include<iostream> 2 #include<cmath> 3 4 using namespace std; 5 6 int main() { 7 int last = 0, now = 0; 8 float run = 0.0; 9 int s = 0, m = 0, h = 0; 10 cin >> last >> now; 11 run = (now * 1.0 - last) / 100.0; //注意整型转化为浮点型 12 h = run / 3600; 13 m = (run - (h * 3600)) / 60; 14 s = round(run - (h * 3600) - (m * 60)); //利用round进行四舍五入 15 16 if (s == 60) { //进位 17 m++; 18 s = 0; 19 } 20 printf("%02d:%02d:%02d", h, m, s); 21 return 0; 22 }
标签:++ 注意 font main 图片 code span img math
原文地址:https://www.cnblogs.com/SCP-514/p/13296705.html