vc编程求助,高手来看看

来源:百度知道 编辑:UC知道 时间:2024/05/10 16:49:52
这是我的一个程序
#include <stdio.h>
#include <math.h>
void main()
{
float a,b,c;
float d;
float x1,x2;

printf("input a,b,c: ");
scanf("%f%f%f", &a&b&c);
d = sqrt (b*b-4*a*c);
x1= (-b+d)/ (2*a);
x2= (-b-d)/ (2*a);
printf("x1= %.2f x2 =%.2f\n", x1, x2);
}
#include <stdio.h>
#include <math.h>
void main()
{
float a,b,c;
float d;
float x1,x2;

printf("input a,b,c: ");
scanf("%f%f%f", &a&b&c);
d = sqrt (b*b-4*a*c);
x1= (-b+d)/ (2*a);
x2= (-b-d)/ (2*a);
printf("x1= %.2f x2 =%.2f\n", x1, x2);
}
e:\program files\microsoft visual studio\myprojects\ex3_2\f.cpp(17) : fatal error C1010: unexpected end of file while looking for precompiled header directive
总是出现这个

环境设错了
Project->Settings...
切到C/C++标签,Category中选择“Precompiled Headers”,下面选择“Not using precompiled headers”,点击确定,重新编译链接就好了

我在自己电脑上运行了下没出现你说的那个错误,你在新建文件的时候有没有建立一个新的工作区哦?还有我电脑上出现的错误是scanf("%f%f%f", &a&b&c); 中的&a,&b,&c 要用逗号隔开! 你再试下!