String to int

hey, i want to convert a string into an int. how do id do that?

Use string stream.
#include <sstream>

using namespace std;

int main (){
int n;
string s = "104";

stringstream(s)>>n;

return 0; }
thank you :)

Topic archived. No new replies allowed.