1.C风格字符串
语法:char 变量名[] ="hello word";
char a[]="hello word";
cout<<a<<endl;//打印结果为hello word
2.C++风格字符串
注意:vs2019以下版本需要包含头文件 #include<string>
语法:string 变量名 ="hello word";
string a="hello word";
cout<<a<<endl;//打印结果为hello word
最后
以上就是昏睡月饼最近收集整理的关于C++字符串型两种风格的全部内容,更多相关C++字符串型两种风格内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复