请高手帮我看看这段代码错哪了
我写了个解一元二次方程的代码老是不对请高手帮我看看#include <stdio.h>
#include <math.h>
void main()
{
double a,b,c,disc,x1,x2,p,q;
printf("input coefficient a b c:");
scanf("%lf%lf%lf",&a,&b,&c);
disc=b*b-4*a*c;
if(disc<0)
printf("the equation hasn't real roots\n");
else
{
P=-b/(2.0*a);
q=sqrt(disc)/(2.0*a);
x1=p+q;
x2=p-q;
printf("real roots:\nx1=%-7.2f\nx2=-7.2%f\n",x1,x2);
}
}
错误是:--------------------Configuration: 1 - Win32 Debug--------------------
Compiling...
1.c
F:\files\vc\1.c(13) : error C2065: 'P' : undeclared identifier
F:\files\vc\1.c(13) : warning C4244: '=' : conversion from 'double ' to 'int ', possible loss of data
执行 cl.exe 时出错.
1.obj - 1 error(s), 0 warning(s)