在实现以上结果之前,程序内包含一些错误,调试之后,才得到以上结果
图。程序中代码修改部分如下:
1 、t.clear();
改为
t="";
2、string temp=rs;
temp.replace(temp.begin(),temp.end(),temp.rbegin(),temp.rend());
改为:
string s_temp=rs;
string temp;
string stack_t;
stack_t.append(s_temp);
for(int z=s_temp.length()-1;z>=0;z--)
{
temp+=s_temp[z];
}
二、 流程图