I have search it again and search this question in baidu. Then I find 2 ways:
1,
char ch[]={'a','b','c','d','e','f','g','\0'};_x000D_
string s=ch;_x000D_
cout<<s;
_x000D_
Be aware to that '\0' is necessary for char array ch.
2,
#include<iostream>_x000D_
#include<string>_x000D_
#include<strstream>_x000D_
using namespace std;_x000D_
_x000D_
int main()_x000D_
{_x000D_
char ch[]={'a','b','g','e','d','\0'};_x000D_
strstream s;_x000D_
s<<ch;_x000D_
string str1;_x000D_
s>>str1;_x000D_
cout<<str1<<endl;_x000D_
return 0;_x000D_
}
_x000D_
In this way, you also need to add the '\0' at the end of char array.
Also, strstream.h file will be abandoned and be replaced by stringstream