您当前的位置: 首页 >  ar

txwtech

暂无认证

  • 3浏览

    0关注

    813博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

ca33a_demo_c++_新旧代码的兼容char数组与vector_string相互转换

txwtech 发布时间:2020-01-28 15:01:30 ,浏览量:3

/*ca33a_demo_c++33_CppPrimer_新旧代码的兼容_txwtech 旧代码:数组和c风格字符串 新代码:vector和string 相互转换: c风格字符串string 数组vector

C3867错误。https://docs.microsoft.com/zh-cn/cpp/error-messages/compiler-errors-2/compiler-error-c3867?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev15.query%3FappId%3DDev15IDEF1%26l%3DZH-CN%26k%3Dk(C3867)%26rd%3Dtrue&view=vs-2019

const char *str=st.c_str(); c_str后面的括号不要忘记写上

*/

/*ca33a_demo_c++33_CppPrimer_新旧代码的兼容_txwtech
旧代码:数组和c风格字符串
新代码:vector和string
相互转换:
c风格字符串string
数组vector

C3867错误。
https://docs.microsoft.com/zh-cn/cpp/error-messages/compiler-errors-2/compiler-error-c3867?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev15.query%3FappId%3DDev15IDEF1%26l%3DZH-CN%26k%3Dk(C3867)%26rd%3Dtrue&view=vs-2019
const char *str=st.c_str(); c_str后面的括号不要忘记写上

*/

#include 
#include 
#include 
using namespace std;

int main()
{
	string st("Hello World");
	st = st + " bill";
	cout             
关注
打赏
1665060526
查看更多评论
0.0484s