利用一个程序进行方程求解出现以下问题
1>c:\users\administrator\desktop\c语言\no.2\4.1(1)\4.1(1)\4.1(1).cpp(17): warning C4477: “fprintf”: 格式字符串“%f”需要类型“double”的参数,但可变参数 1 拥有了类型“float *”
导致程序的输出文件出现的都是零
C4477说的缓存区到底怎么用
问题是否在于fprintf如果不是的话错误在哪里?
谢谢作答
以下为原码
//1.Introduce the system function
#include "stdafx.h"
#include"stdlib.h"
#include"stdio.h"
void main(void)
{
float a, b, c, x, y;
//2.Open the file and write the marks into file
FILE*file1, *file2;
file1 = fopen("PARADAT.txt", "r");
file2 = fopen("PARAOUT.txt", "w");
for (int k = 1; !feof(file1); k++)
{
fscanf(file1, "%f;%f;%f", &a, &b, &c);
x = -(b / (2 * a));
y = (4 * a*c - b*b) / 4 * a;
fprintf (file2, "(%f,%f,%f)", &a, &b, &c);
fprintf (file2, "(%f,%f)", &x, &y);
}
//3.Close the file
fclose(file1);
fclose(file2);
}
C语言fprintf的使用问题,C4477
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
悬赏问题
- ¥50 汇编语言除法溢出问题
- ¥65 C++实现删除N个数据列表共有的元素
- ¥15 Visual Studio问题
- ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
- ¥20 求一个html代码,有偿
- ¥100 关于使用MATLAB中copularnd函数的问题
- ¥20 在虚拟机的pycharm上
- ¥15 jupyterthemes 设置完毕后没有效果
- ¥15 matlab图像高斯低通滤波
- ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗