+ 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.

23rd Jul 2017, 2:26 PM
Ebenezer
Ebenezer - avatar
1 Odpowiedź
+ 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"
23rd Jul 2017, 3:05 PM
Aleksandar Stevanovic
Aleksandar Stevanovic - avatar