Module: (C++) Arithmetic expressions


Problem

5 /7


How to write arithmetic expressions

Theory Click to read/hide

Rules for coding arithmetic expressions


Suppose we need to calculate the value of the expression written in mathematical form:
\({ 2\ \cdot\ 17,56^2 \over {7\ \cdot\ 2,47\ \cdot\ 0,43}}\)
 
Before writing a program that will calculate the result for us, we formulate the RULES for writing algebraic expressions in a programming language:
1. Expressions contain numbers, names of other variables, operators, parentheses, function names
2. Arithmetic operators (+, -, *, /, %)
3. The separator of the integer and fractional parts is the point.
4. The expression is written one per line (linear recording of expressions), the characters are sequentially arranged one after another,  for EVERYTHING operation signs are affixed; parentheses are used.


Thus, following the rules for coding arithmetic expressions, we must translate this (mathematical notation) fraction into a line.
Because the numerator and denominator are complex (that is, they contain two or more operators), then when writing to a linear form, it is necessary to take the expressions in the numerator and denominator in brackets.
Thus, a linear record of such an expression will look like this:

(2*17.56*17.56)/(7*2.47*0.43)

We will write a program to calculate the value of the expression: for this we decide on the input and output data

Input  
Because we know all the values, then you don’t need to input anything from the keyboard, therefore there will be no input data.

Output 
The program must output the value of the arithmetic expression (you can put it into any variable, or you can immediately output the value).


We will immediately output the value of the expression without saving it in any variable.
Because if we have a fraction, then the result will be a real number
#include<iostream>
using namespace std;

int main()
{ 
  cout << (2*17.56*17.56) / (7*2.47*0.43);
  return 0;
}
Run the program on the computer and make sure that it produces a result equal to 82,949843.

After that, complete the task.

Problem

Write a program that calculates the value of the expression

\({x + y\over {x +1}}-{x\cdot y-12 \over 34 + x}\)


Input
x and y are integer variables.

Output
output a single number - the value of the expression
 
Examples
Input Output
1 1 2 1.786


Hint
Do not forget that when dividing, you need to get a real number!