Replace x with a string containing int variables

Hi guys,

I've got another question again.

I have this problem:

Example, i have an equation which is read from a .txt file.

x^2 + 5*(x + 3) - 10

then, lets say that i want to replace "x" with a string "(a*(x+1))"

where a is computed to be equal to 3.1415

such that the resulting string shall be

(3.1415*(x+1))^2 + 5*((3.14*(x+1))+3) - 10

Any algorithm in C++ that I can use?

Or any headstart on how I can convert an int value into character.

Thank you in advance. :)


Edit:

I am thinking of this, instead of converting int/double/float to char, I should have printed the output to a text file, instead.

The only problem I have is putting this string to an original string.
:(
Last edited on
Topic archived. No new replies allowed.