Misdreavus
used Perish Song!
I'm trying to make a decimal number appear in the exact form of XX:XX. The number is a double representing seconds (while I also have a corresponding integer for minutes), so it's guaranteed to be less than 100, or more specifically, less than 60.
I know that:
I know that:
- If x is an integer (printed by %d), I can expand its representation to 2 digits by using %02d. This means that 54 would be printed as 54, 4 would be printed as 04, and 672 would still be printed as 672.
- If x is a double (printed by %lf), I can expand/contract its decimal representation to 2 digits by using %.2lf. This means that 1 would be printed as 1.00, 1.2 would be printed as 1.20, and 1.23241 would be printed as 1.23.
Last edited: