I was wondering if it would be possible to store caluclations contained in a string to integer. For example:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string variable = "-123+432";
cout << stoi(variable) << endl;
}
This returns -123, would it be possible to make it return 309?
Also what if there would be more calculations inside the string (eg. "-123+432*2"), and the person writing program would not know how many calculations will there be in a string (eg. string would be entered by user when the programm is runing).
Thanks for all answers