how to print the float value?
Solved
General and Desktop
-
Hi all,
i am trying to print float value in qlabel..i tried this ..
float f=1/32;
qDebug()<<f;
QString time = QString::number(t1);
timer_txt->setText(time);output should print 0.03125 but it print 0
help me...
-
Hi all,
i am trying to print float value in qlabel..i tried this ..
float f=1/32;
qDebug()<<f;
QString time = QString::number(t1);
timer_txt->setText(time);output should print 0.03125 but it print 0
help me...
hi,
float f=1/32;
is interpreted as int/int and results in int => 0try to cast one variable or add a dezimal point
//this float f=1/static_cast<float>(32); //or float f=1/32.0;
-
thank for ur help ...