I have tried using:
我试过用过:
scanf("%d %d %d", &hour, &min, &sec);
printf("%d %d %d", hour, min, sec);
but it does not work, I think I have to bypass the ":" but am unsure how to do this.
但它不起作用,我想我必须绕过“:”但我不确定如何做到这一点。
Cheers
干杯
1 个解决方案
#1
3
Please try:
请尝试:
if (scanf("%d:%d:%d", &hour, &min, &sec) != 3)
…error handling…
#1
3
Please try:
请尝试:
if (scanf("%d:%d:%d", &hour, &min, &sec) != 3)
…error handling…