浮点数的输入和输出 // 输出,对于单精度和双精度变量n printf("%f",n); // 输入 变量n // 对于单精度 scanf("%f",&n); // 对于双精度 scanf("%lf",&n); 参考:《C Primer Plus 》第六版