当输入为“08”或“09”而不是其他类似的数字(例如“03”或“07”)时,程序会多次执行 printf 命令。
do
{
printf("Enter date:");
scanf("%i/%i/%i", &d, &m, &y);
}
while (d !=0 || m != 0 || y != 0);
这是输出(数字由用户输入) -
Enter date:3/6/8
Enter date:3/6/08
Enter date:Enter date:04/05/06
Enter date:08/08/08
Enter date:Enter date:Enter date:Enter date:01/02/03
Enter date:04/05/06
为什么会发生这种情况,我该如何解决?