利用一个程序进行方程求解出现以下问题
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 提建议
- 追加酬金
- 关注问题
- 邀请回答
-