string::back

char& back();
const char& back() const;

#include <iostream>
#include <string>

using namespace std;
int main()
{
string s1("hello");
cout << s1.back() << endl;
s1.back() = 'e';
cout << s1 << endl;
return 0;
}

posted @ 2019-12-23 13:18  MoonXu  阅读(187)  评论(0编辑  收藏  举报