string类的成员函数c_str()

#include <iostream> #include <string> using namespace std; int main() { char * a ="Hello world!/n"; string c=a; string b; cin >> b; const char *d = b.c_str(); //注意是const cout << a << endl << b << endl << c << endl << d << endl; system("pause"); return 0; }

你可能感兴趣的:(c,String,System,include)