Use int
when you need to store a whole number without decimals, like 35 or 1000, and float
or double
when you need a floating point number (with decimals), like 9.99 or 3.14515.
int
int myNum = 1000;
cout << myNum;
cout << myNum;
float
float myNum = 5.75;
cout << myNum;
cout << myNum;
double
double myNum = 19.99;
cout << myNum;
cout << myNum;
Scientific Numbers
A floating point number can also be a scientific number with an "e" to indicate the power of 10:
Example
float f1 = 35e3;
double d1 = 12E4;
cout << f1;
cout << d1;
double d1 = 12E4;
cout << f1;
cout << d1;
Practice Excercise Practice now