什么是std::string...?怎么用

std::string是标准C++的字符串实现。为了让程序好移植,要用std::string。好比:c++

方法1:spa

#include <string>
std::string3d

方法2:blog

#include <string>
using namespace std;
string字符串

扩展资料:get

显式引入std名空间,std是c++的标准,这个名空间里面定义了不少类,如经常使用的string等。 
若是咱们使用名空间std中的类,为了防止和其余的类库名称冲突,就须要在程序中加入语句:using namespace std; string

若是咱们只是使用其中的一个或者几个类的话,也能够不显示引入该名空间,而是这样:std::string 也能够。it

相关文章
相关标签/搜索