0
I m a beginner in c++ . plz tell me when to use float and when to use int??
4 Answers
0
Float is for real values - 1.5, 2.2, etc.
Int is for integer values - 1, 2, 10, etc.
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).
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