Thread: Why does my program get these warnings?Could you help me?

1. Why does my program get these warnings?Could you help me?

im getting this warnings but i've not solved it yet, when i compile the program, in the 400 line , these 3 lines are gives warning, and it makes me unhappy.I want perfect.
Some parts of my program

Code:
```#include <stdio.h>
#include <math.h>
..
float delta,r1,r2,b,a,c,ii1,ii2=0;
..
if (delta>0)
{
w ->    r1=(b-sqrt(delta))/(2*a);
w ->    r2=(b+sqrt(delta))/(2*a);
printf(" r1=%f\n r2=%f\n\n\n",r1,r2);
}
.....
else
{
r1=b/(2*a);
w ->   ii1=(sqrt(-delta))/(2*a);
// r2=-b/(2*a)
//ii2=sqrt(-delta)/(2*a));
printf(" r1=%f+i%f\n r2=%f-i%f\n\n\n",r1,ii1,r1,ii1);
}
.....
return 0;```
here is the warnings
warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
there are three same warnings

thanks for reading my topic.Help me plz

2. > float delta,r1,r2,b,a,c,ii1,ii2=0;
So change this to

double delta,r1,r2,b,a,c,ii1,ii2=0;

floats are a historic relic, from when machines had very limited amounts of memory (say 64KB - Yes, you read it right - Kilobytes) and no floating point hardware.

3. Finished.obj - 0 error(s), 0 warning(s)
Thank you Salem )))))))) im very happy

Popular pages Recent additions