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