string::pop_back

void pop_back();//弹出最后一个字符

#include <string>
#include <iostream>

using namespace std;
int main()
{
string str("hello world!");
str.pop_back();
cout << str << endl;
return 0;
}

posted @ 2020-01-10 20:15  MoonXu  阅读(468)  评论(0编辑  收藏  举报