【发布时间】:2010-12-29 10:15:00
【问题描述】:
你如何使用 scanf 的返回值来确保它是我得到的双精度值?
double input;
do { /* do this as long as it not a double */
printf("Input?");
scanf("%lf", &input);
} while(scanf("%lf", &input) != 1); /* this will not work */
【问题讨论】:
标签: c validation input