string str(“hello world”);
string *pstr=&str;
cout<<*pstr<<endl;
//cout <<pstr[0]<<endl;
需要 #include < string >
本文展示了一个使用C++进行字符串操作的简单示例,包括使用stringstr函数和指针来输出字符串。代码中包含了基本的字符串初始化和输出操作,对于初学者理解C++中的字符串处理很有帮助。
string str(“hello world”);
string *pstr=&str;
cout<<*pstr<<endl;
//cout <<pstr[0]<<endl;
需要 #include < string >

被折叠的 条评论
为什么被折叠?