标签:ons iostream 对象 ring const end cout 功能 name
char& front(); const char& front() const;
功能:返回string对象的首个字符,可以改变它的值
#include <string>
#include <iostream>
using namespace std;
int main()
{
string s1("test");
cout << s1.front() << endl;
s1.front() = ‘T‘;
cout << s1 << endl;
string s2;
cout << s2.front() << endl;
}
标签:ons iostream 对象 ring const end cout 功能 name
原文地址:https://www.cnblogs.com/xpylovely/p/12094262.html