float r = 5.0f
or
double r = 5.0
The value 5.0 is a number represented as a decimal fraction (has an integer and a fractional part). In computer science, such numbers are called real
Real number is a number that has an integer part and a fractional part. The integer and fractional parts are separated from each other by a dot, not by a comma as in mathematics.
Even if the fractional part of the number is zero, as in the \(r\) variable in the example, the translator will still create a real variable in memory. The point, as it were, a signal for the translator that it is necessary to create a real variable. 

Very large and very small numbers  are written using "floating point" (in the so-called scientific format).  
In scientific format, a number is represented as mantissa(significant part of the number) and exponent. When notated, the mantissa and exponent are separated from each other by the letter e (denoting 10 to some extent). 
For example, you can store the value of the charge of an electron ( \(1.60217662 \times 10^{-19}\) C) in a variable, writing in the following form
float El = 1.60217662e-19f //for a positive order, the + sign can be omitted
or
doubleEl= 1.60217662e-19
Almost all real numbers cannot be stored in computer memory with perfect accuracy, since a limited number of bits are allocated for their storage. Therefore, when calculating with real numbers, errors associated with the inaccuracy of the representation accumulate. Moreover, the less space allocated, the greater this error will be. In order to reduce the error in Java, the double type is used, which stores a real number with double precision in memory (occupies eight bytes in memory, while the type \(float \)- 4 bytes)

Input

You can enter several real variables from the input stream and write them into variables in the standard way:
float x, y;
cin >> x >> y;
The first number falls into the \(x\) variable, the second into \(y\) variable

Output

When outputting real numbers, the default is 6 decimal places, while the scientific format or with a fixed comma is automatically selected.
You can configure the output as needed by the condition of the task. For this, an additional iomanip library is used - manipulators that control the output.
The fixed command is used to output in fixed-point format, and scientific is used for the scientific format. Then you need to determine the number of digits in the fractional part using the setprecision command. Using the setw  command, you can specify the total number of positions allocated to output the number

Example:
float x = 1.0/6;
cout << fixed << setprecision (9);  // установили вывести 9 цифр в дробной части
cout << setw(12) << x;                            
The screen outputs
_0.166666672                  
All commands can be written in one line:
cout << fixed << setprecision(9) << setw(12) << x;

When working with real numbers, you can use the familiar сmath module, which contains a large number of built-in functions.
When solving problems, one often has to round real numbers to the nearest integer values. There are two functions for this.

REMEMBER
1
with explicit type conversion ( float x=1.5; int y = int (x))  -  the fractional part of the real number is cut off (y = 1) 
2 function floor(x) - returns the value of \(x\) rounded down to its nearest integer \(x\) 
3 function ceil(x) -  returns the value of \(x\)  rounded up to its nearest integer 

Here are the most useful functions contained in the module cmath.
Функция Описание
Округление
round(x)
C++ 11
returns the integral value that is nearest to x, with halfway cases rounded away from zero.
trunc(x)
C++ 11
rounds x toward zero, returning the nearest integral value that is not larger in magnitude than x
floor(x) returns the value of \(x\) rounded down to its nearest integer   floor(1.5) == 1floor(-1.5) == -2
ceil(x) returns the value of \(x\)  rounded up to its nearest integer ceil(1.5) == 2ceil(-1.5) == -1
abs(x) returns the absolute value of x
fabs(x) returns the absolute value of a floating x
Корни, логарифмы
sqrt(x) returns the square root of x.  y = sqrt(x). The function takes a single non-negative argument. If negative argument is passed to sqrt() function, domain error occurs.
pow(x, y) returns the value of x to the power of y. \(x^y\)
log(x) returns the natural logarithm of a number.
exp(x) returns the base-e exponential function of x, which is e raised to the power xex.
Тригонометрия
sin(x) returns the sine of an angle of x radians.
cos(x) returns the cosine of an angle of x radians.
tan(x) returns the tangent of an angle of x radians
asin(x) returns the principal value of the arc sine of x, expressed in radians. In trigonometrics, arc sine is the inverse operation of sine.
acos(x) returns the principal value of the arc cosine of x, expressed in radians. In trigonometrics, arc cosine is the inverse operation of cosine.
atan(x) returns the principal value of the arc tangent of x, expressed in radians. In trigonometrics, arc tangent is the inverse operation of tangent
x) returns the principal value of the arc tangent of y/x, expressed in radians. To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant.