+ 3
what is the use of float
7 Respostas
+ 10
"float" is a data type like "int", used for real numbers(decimal point numbers).
example - 5.6, 7.0, 172.5347
for example->
int a=6;
float b=7.99;
If we declare a float type variable as integer, compiler will take it as floating type.
for example->
float c=19;
In this value of "c" is taken as "19.0" by the compiler.
So using "float c=19" doesn't generate any errors.
+ 1
Exactly as Preetan Daila explained...
For storing decimal point numbers in your program you also have the "double" and "long double" data type... variables that are declared as "double" has more precisicion than "float" (can store more decimal numbers after the decimal point) but use more memory in your program.
Hope it helped
0
plz wite in english not other language
0
float is a data type in c++. Like int which also a data type in c++ which store integer number in the variables, the float data type stores floating number in the variables.
For ex-
let x be a variable.
if we have to store 5 in x then the syntax will be
int x=5;
and if we have to store 5.15 in x then the syntax will be
float x=5.15;
0
float is used to declare number with decimal
0
float is used for division like 3÷5= 0.6
- 4
é o uso de uma variável do tipo real.