+ 2

Can someone give me some hints to make a program in c++ that solves expressions?

I'm just a beginner and i'm trying to make a program that solves expressions, but i can't figure out how. p.s. sorry for my poor english

14th Mar 2017, 7:25 AM
Giovanni Del Gallo
Giovanni Del Gallo - avatar
16 ответов
+ 25
using functions overloading u can do it
14th Mar 2017, 11:12 AM
Mansi Dagla
Mansi Dagla - avatar
+ 22
its tough in cpp as there +, -, *, /, (, ) are char type input and 3,7,5.0 are int and float type input u can't mixed them together in a single variable
14th Mar 2017, 11:02 AM
Mansi Dagla
Mansi Dagla - avatar
+ 22
may be using functions and stack
14th Mar 2017, 11:07 AM
Mansi Dagla
Mansi Dagla - avatar
+ 21
cout<<3*(7-3)+12; this will print the result simple in this first brackets will solve, then multiplication and then addition
14th Mar 2017, 9:40 AM
Mansi Dagla
Mansi Dagla - avatar
+ 21
u can also take one variable like a and store the value of ur expression in it like a=3*(7-3)+12; and then print it cout <<a;
14th Mar 2017, 9:42 AM
Mansi Dagla
Mansi Dagla - avatar
+ 21
go and check my code named expression solver
14th Mar 2017, 9:56 AM
Mansi Dagla
Mansi Dagla - avatar
+ 21
u want to insert the whole expression or want to insert the value for this expression
14th Mar 2017, 10:28 AM
Mansi Dagla
Mansi Dagla - avatar
+ 20
write that expression here
14th Mar 2017, 9:29 AM
Mansi Dagla
Mansi Dagla - avatar
+ 3
What expressions
14th Mar 2017, 9:07 AM
Shirious
Shirious - avatar
+ 2
every expression is fine, you can use 3*(7-3)+12 for example
14th Mar 2017, 9:37 AM
Giovanni Del Gallo
Giovanni Del Gallo - avatar
+ 1
math expressions
14th Mar 2017, 9:14 AM
Giovanni Del Gallo
Giovanni Del Gallo - avatar
+ 1
wait, it doesn't work
14th Mar 2017, 9:50 AM
Giovanni Del Gallo
Giovanni Del Gallo - avatar
+ 1
yea, but i have to be able to insert the expression
14th Mar 2017, 10:02 AM
Giovanni Del Gallo
Giovanni Del Gallo - avatar
+ 1
i want a code that solves any expression
14th Mar 2017, 10:30 AM
Giovanni Del Gallo
Giovanni Del Gallo - avatar
+ 1
there must be a way to solve any expression
14th Mar 2017, 11:06 AM
Giovanni Del Gallo
Giovanni Del Gallo - avatar
+ 1
that's what I want to do
14th Mar 2017, 11:08 AM
Giovanni Del Gallo
Giovanni Del Gallo - avatar