I have an expression in form of string to solve like:

a = 10

b = a++

c = a + b

If inputs are in string, how to use “a” or other characters as int and store the corresponding value like “a” as 10 so that it can be used to solve other expression ?

I have an expression in form of string to solve like:

a = 10

b = a++

c = a + b

If inputs are in string, how to use “a” or other characters as int and store the corresponding value like “a” as 10 so that it can be used to solve other expression ?

About characters, you can simply convert them into integers/digits by knowing their ascii value. Such as:-

char ch=‘5’;

int num=int(ch)-48;

num will be assigned 5.

For strings, you can use the following code:-

int num=Integer.parseInt(“1234”);(If you code in Java)

In C++, you can fetch individual characters of the string and convert them into integers using the above said technique.