我有一个程序,它显示从文本文件中读取的歌曲以及时间,并在控制台中以整齐有序的方式显示它们。但是我遇到了问题,但是有一个整数显示,01
或者与我的时间格式(00:00:00)06
相反。当整数低于 10 时,我将如何操作输出以在整数前面显示零?1
6
我的程序的示例输出:
SONG TITLE
The once and future carpenter 0:4:52
I never knew you 0:7:48
Life 0:10:52
February seven 0:15:0
My lfe 0:24:12
Yuor frei 0:37:20
Lisjlf 0:49:23
Lasifj 0:53:39
Longsong 1:9:2
Longer 1:22:3
Almost done 1:34:48
Process returned 0 (0x0) execution time : 0.280 s
Press any key to continue.
期望的输出:
SONG TITLE
The once and future carpenter 00:04:52
I never knew you 00:07:48
Life 00:10:52
February seven 00:15:00
My lfe 00:24:12
Yuor frei 00:37:20
Lisjlf 00:49:23
Lasifj 00:53:39
Longsong 01:09:02
Longer 01:22:03
Almost done 01:34:48
Process returned 0 (0x0) execution time : 0.280 s
Press any key to continue.