0

I m a beginner in c++ . plz tell me when to use float and when to use int??

12th Feb 2019, 12:35 PM
mohit3 Hambire
4 Respostas
0
Float is for real values - 1.5, 2.2, etc. Int is for integer values - 1, 2, 10, etc.
12th Feb 2019, 1:00 PM
Susanta Paul
Susanta Paul - avatar
+ 2
Thanx Androidus , B4DM3N and peter
12th Feb 2019, 1:11 PM
mohit3 Hambire
0
Float is used whenever you want to store decimal numbers(for example 3.14). Their disadvantage is that they can be inaccurate at times, due to the fact that they are being stored in a binary system. Int is used whenever you want to store whole numbers(for example 7).
12th Feb 2019, 12:58 PM
Alexandru Turculet
Alexandru Turculet - avatar
0
just think of floats as the decimal point floats we used to call them Real numbers so Pi would need a float 3.14 as the floating points needed. whole numbers no points tends to be integers
12th Feb 2019, 1:07 PM
peter
peter - avatar