Hello, im new in C++ and im getting annoying error. Maybe anyone could explain me where is the problem. Compiler shows that a problem is in a line 20 If (D<0).
Code:
#include <stdio.h>
#include <stdlib.h>
int main ()
{
float a,b,c,D,x1,x2;
printf ("Iveskite a kintamaji \n");
scanf ("%f",a);
printf ("Iveskite b kintamaji \n");
scanf ("%f",b);
printf ("Iveskite c kintamaji");
scanf ("%f",c);
if (a=0)
{
printf ("Lygtis ne kvadratine, niekas nebus apskaiciuota \n");
system ("pause");
return 0;
}
else
D =(b*b) - (4*a*c);
If (D<0)
printf ("Sprendiniu nera \n");
else
{
x1= ((-1)*b-sqrt(D))/(2*a);
x2= ((-1)*b+sqrt(D))/(2*a);
Printf ("Atsakymai: %f, %f \n",x1,x2);
system ("pause");
return 0;
}
}