hi
so i am studying programming and i want to extract from an inputted string values in the left right and middle.
i have only begun learning a few months ago so i dont know anything about pointer
how to i build a funtion to extract the mid left and right of string.
For instance the input was 25+63=11
i want to extract the first number the opperand the second number and the answere so
a=25
b=+
c=63
d=11
so that i can add/sub/multiply/divide the first two numbers and check if the answere in the string is correct.
thank you.

Good news. Or rather a sip from the fire hose.

There are over 53 examples at https://rosettacode.org/wiki/Arithmetic_evaluation including C++. In the C++ example they used the Boost library and in there you can see how they parsed the expression.

Now that's not ready to use for your question but very close. You can parse out your string up to the equal sign then use the Rosettacode example to get the answer then you parse out whats past your equal sign and see if that compares.

commented: thank you so much your feedback has been really helpful +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.