萌新,30分,求求大佬指点

P5707 【深基2.例12】上学迟到

tem是浮点类型的,怎能自增呢? ```cpp #include <bits/stdc++.h> using namespace std; int main() { int HH = 7, MM = 50, tem; double s, v; cin >> s >> v; tem= s / v; if (tem < s / v) { tem++; } MM -= tem; while (MM < 0) { HH--; MM += 60; if (HH < 0) { HH = 23; } } cout << setw(2) << setfill('0') << HH << ':' << setw(2) << setfill('0') << MM; return 0; } ```
by Alss @ 2023-04-28 01:28:50


浮点类型能自增 例如:1.34+1=2.34 **** 2.6+1=3.6
by jaehaerys @ 2023-05-02 15:14:25


```cpp if (tem < s / v) { #若tem=3.14 tem++; #则tem=4.14 } ```
by jaehaerys @ 2023-05-02 15:18:41


|