Mar 1, 2016 at 7:22pm
If I have an String 107 and I'm turning it into a char so it's the digit symbols 1 0 7. Is it possible to turn it into an int of 107?
Mar 1, 2016 at 11:00pm
you can use sstream
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// Example program
#include <iostream>
#include <string>
#include <sstream>
int main()
{
std::string stringval("107");
std::stringstream converter;
converter << stringval;
int intval;
converter >> intval;
std::cout << intval;
}
|
Last edited on Mar 1, 2016 at 11:03pm