#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main(){
stringstream ss;
ss << 32;
string str = ss.str();
cout << str << endl
<< str[0] << endl
<< str[1] <<endl
<< str[0]%10;
return 0;
}
出力は次のとおりです。
32
3
2
1
代わりに、3%10=3 として最後の行を 3 にする必要があります。