This question already has an answer here:
Today i was trying to print a double value with printf using %lf but got 0.000000 . but when I tried to print the same thing with %f I got correct result. Why this happened? I use c++0x(c++11 I think.)
#include<stdio.h>
int main()
{
double aaa;
aaa=1.23;
printf("%lf\n",aaa);
printf("%f\n",aaa);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire