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 access each element in your string using the [] operator, which will return a reference to a char. You can then deduct the int value for char '0' and you will get the correct int representation.
for(int i=0;i