我正在开发的程序遇到了一个小问题,我不断收到警告format '%1f' expects type 'float *' but argument 2 has type 'double *'
所以我相当确定这是我的问题scanf
format.
我尝试到处寻找解决方案,但似乎找不到。
该函数读取两个数字。
void read(double *n1, double *d1)
{
printf("Enter the number n1: ");
scanf("%1f", n1);
printf("Enter the number d1: ");
scanf("%1f", d1);
}
Use scanf("%lf", n1)
for double
;注意“l”(el,而不是“one”)。
如果您是编程新手,请尝试熟悉文档,例如参考参数 http://en.cppreference.com/w/cpp/io/c/fscanf。例如,您可以在那里找到格式和长度指定的矩阵scanf
.
享受学习编程的乐趣,使用谷歌等,并毫不犹豫地询问:-)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)