I have a string that contains what ever the user has input
string userstr = \"\"; cout << \"Please enter a string \"; getline (cin, userstr); <
string userstr = \"\"; cout << \"Please enter a string \"; getline (cin, userstr);
You can just simply use isstringstream to convert the string to int as follows
istringstream istringName(intString); istringName >> real_int_val;
now it has magically become a int containing all numbers from string However I do not see why you would not cin it as a int in the first place??