unsigned short n = 1;
double number1=1.0, number2=1.0;
printf("请输入两个浮点数:\n");
for (n = scanf_s("%f %f", &number1, &number2); n == 2; n = scanf_s("%f %f", &number1, &number2))
{
printf("number1=%f,number2=%f\n", number1, number2);
printf("所求值为%f\n", Production_divide_difference(number1, number2));
printf("继续请再次输入两个浮点数,退出请输入q:\n");
}
printf("退出");
这是输出结果
可以发现number1和number2均未被scanf放入输入的值,依旧是声明变量时初始化的值。
排查了许久也不清楚是哪里出了问题,c语言初学者,还望教导。