+ 1

C++ programming doubt

How to make a c++ program that solves any linear equation in one variable . For example if I input x=42*x -76+7 ,it should be able to answer. Please Help!!

25th Feb 2017, 6:59 AM
TargetIIT
2 odpowiedzi
+ 3
you need to read the whole string then read each character. then depending on what character it is you do something
25th Feb 2017, 8:07 AM
chris
chris - avatar
0
TargetIIT, you could either go by the brute force approach, and just try numbers until you reach a solution, but that is neither efficient nor smart. But in order to solve this question, you need to know what kind of equations you are dealing with. That way, you know what the syntax of the equation will be and then you can formulate a solution that involves parsing the input and breaking it up.
25th Feb 2017, 7:56 AM
Tomer