How can I solve a mathematical expression following the hierarchy of operations? Resolver siguiendo la jerarquía de operaciones. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How can I solve a mathematical expression following the hierarchy of operations? Resolver siguiendo la jerarquía de operaciones.

Tengo que realizar una calculadora y esta debe de resolver la expresión matemática que se le ingrese, la debe de resolver siguiendo la jerarquía de operaciones, es decir: Primero resolver lo que hay dentro de paréntesis. Luego las potencias Luego la multiplicación y división Por último las sumas y restas ¿Cómo hago para que lea de está manera la expresión matemática y la resuelva? Por ejemplo en Python existe la función eval() que resuelve correctamente este tipo de expresiones. En C++ existe alguna función como eval()??? I have to make a calculator and it must solve the mathematical expression that is entered, it must solve it following the hierarchy of operations, that is: First solve what is inside the parentheses. Then the powers Then the multiplication and division Finally the addition and subtraction How can I get the mathematical expression to read in this way and solve it? InPython there is the function eval () that correctly solves this type of expressions.In C ++ is there some function like eval()?

14th Apr 2020, 9:51 PM
Hugo Raúl López Enríquez
1 Antwort