Quoted for truth - look at Cornstalk's post. The only place int to string (not vise-versa) is needed, is for putting the results in a new string if the OP desires.
At no point should stringstream, atoi, etc. have anything to do with it.
I'd do it something like this:
Cast string to lowercase. (std::transform, and std::tolower)
Iterate over each char in string (just index into it)
I'd cast the char to an int
//Since ASCII lowercase letters begins at 97, and goes to 122, and space is 32...
if the int is 32
. . . .output a '-' to the result, if desired, or leave it as a space, or discard it.
if the int is over 122 or under 97
. . . .output a ? to the result, or discard that char
. . . . Subtract 96, so 'a' becomes '1', and so on.