+ 3

what is the use of float

28th Jul 2016, 1:49 AM
Prabhat
7 Réponses
+ 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.
28th Jul 2016, 5:14 AM
Preetam Daila
Preetam Daila - avatar
+ 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
28th Jul 2016, 10:32 AM
Nelson Urbina
Nelson Urbina - avatar
0
plz wite in english not other language
28th Jul 2016, 3:46 AM
Daman
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;
14th Aug 2016, 5:55 AM
Pritam Das
Pritam Das - avatar
0
float is used to declare number with decimal
24th Oct 2016, 5:11 AM
ravi
0
float is used for division like 3÷5= 0.6
6th Jan 2017, 1:43 PM
Lakshya Sharma
Lakshya Sharma - avatar
- 4
é o uso de uma variável do tipo real.
28th Jul 2016, 1:55 AM
Rodrigo Soares
Rodrigo Soares - avatar