Module: (C++) Arithmetic expressions


Problem

2 /7


Arithmetic operators and expressions

Theory Click to read/hide

Arithmetic operators and expressions

The expression on the right side of the assignment operator allows you to calculate values using various formulas.

What expression can contain
1) integer and real numbers (in real numbers, the integer and fractional parts are separated by a dot, not a comma, as is customary in mathematics)
2) signs of arithmetic operators:
+ addition
- subtraction
* multiplication
/ division
% remainder of the division

3) standard mathemtical functions (we can use the math module math.h write at the top of the program #include<math.h>)
 abs(i) - |i|  - absolute value of an integer i 
 fabs(x) - |x|  - absolute value of a real числа x
 sqrt(x) -  \(\sqrt x\)
 pow(x,y) - xy
 
4) parentheses to reorder

Problem

Write a program that calculates the value of the variable y according to the formula:
y = (1 - x+ 2,5x+ x4)2

The value of the variable x is set from the keyboard. Define the types of variables x and y yourself.
Output the value of the variable y on the screen.