+ 1
how would you seperate a three digit string variable into three different variables?
I am trying to create a smart calculator. If a user entered 5*5, i would like to save it as a string and then seperate it into number 1, operator, number 2.
1 Answer
+ 1
i think cpp can use strings like array of char
for example if you have string "5*5", string[0] will be "5", string[1] will be "*", etc...
but have in mind that user can input two digit number, like 55*5, in that case that wont work... try googling "c++ string delimiter"