Doing it the long way, when you have the "AAB+BAB" in an std::string or a char array, you have to iterate through it until you find a '+', or 0.
You can have std::string::find do the loop for you.
When you have the location of +, split the string at that point, evaluate each half and then use a sequence of ifs to perform the right operation. I'm not sure that kind of operations you can do with AAB and BAB though. You never said what the exact problem was.