标签:use strong 崩溃 include return clu microsoft soft 16px
#include<iostream>
#include<string>
using namespace std;
int main(){
string str("abcde"); //字符串初始化
cout<<str<<endl; //用str输出字符串
cout<<str.c_str()<<endl; //用str.c_str()输出字符串
cout<<str[0]<<endl; //用str[]输出字符串中的单个字符 ,越界后崩溃
cout<<str.at(0)<<endl; //用str.at()输出字符串中的单个字符,越界后异常
system("pause");
return 0;
}
标签:use strong 崩溃 include return clu microsoft soft 16px
原文地址:https://www.cnblogs.com/huoyuying/p/9665326.html