在我运行 scanf 之后,printf 的输出被 "\n" 破坏了。我正在尝试使用。
scanf ("%*c");
chomp "\n" 但它不起作用......这是代码
printf("Enter char float int char:", char4, deci2, num2, char5);
scanf ("%c %f %d %c", &char4, &deci2, &num2, &char5);
scanf ("%*c");
printf("You entered: '%c' %.3f %d '%c' " ,char4 ,deci2, num2, char5 );
它输出到
Enter char int char float:a 5 a 5.5
You entered: 'a' 5 'a' 5.500
Enter char float int char:a 5.5 6 b
You entered: '
' 0.000 0 ''