Suppose I have a string "12345" but want to make it into an array, what code or function allows me to do that?
Example: I input: "12345" and I want it to turn into the array (same as typing) [1, 2, 3, 4, 5] in c++. I know that the function stoi.("12345") converts the string into an integer, but how would I go about making that integer be an array?
std::stringcontaining the number, then you can loop over it. The first character will be the'1'(in your example). And you can easily convert a character from a character to its corresponding numeric equivalent of the digit by simply subtracting the character'0'. I.e.'1' - '0' == 1