See what's going on? Code it so that X or the value subtracted from the other integers...i'll let you play with the idea : ) -> Just know this is 1 idea,..not "the" idea.
Firstly, what result do you expect?
If you want to be able to write 5 = 2+x; in your code, it's not possible.
If you want to print "enter an equation:", then when user enters "5=2+x" print "x = 3 !!!", it is possible. How hard it is depends on the complexity of equations. For linear equations it wouldn't be hard at all.
The hardest part would be parsing the string.
If you really want to do it, for practice write a calculator which could calculate "2+3-4" or something. I'd then explain the rest (if needed).
#include <iostream>
usingnamespace std;
int main()
{
/*5 = 2 + x
find the value of x
*/
cout << "the value of x in (5 = 2 + x) is " << 5 - 2;
return 0;
}