I need little help

I am developing a program that will read a function (x^2+2x+4 or other function) and then comparing and start assigning variables. My idea is with an array:

int i,x;
char xs;
char function[20];
cin.getline(function, 20);
cout << "Your function is: ";
for(i=0; function[i]!='\0'; i++)
cout << f[i];
cout << "Enter some value for x: "; cin >> xs;
x = xs-48
for(i=0; function[i]!='\0'; i++){
if(function[i] == 'x'){
function[i] = xs
cout << f[i];

Well this is my basically idea, but when the program detect an ^ this will be associate with the exp(x,n); well in general the user enter a function: x^3+3x^2+4x-8 give a value for x for example 3 and the program will convert in -- exp(3,3)+3*exp(3,2)+4*3-8 --, but I don't know how.
closed account (Dy7SLyTq)
hold on give me a second and ill write out a c-style version that shoud work. do you care about order of operations?
Thank you!! ... and yes I need follow the order
Topic archived. No new replies allowed.