字符串类型转化成字符数组没别的办法,只能一个个字符的赋值,如下 for(int i=0;i<a.length();i++) b[i] = a[i]; b[a.length()] = '\0';
字符数组转化成字符串类型很方便只需要 a = b; 就可, a为string类型(需添加#include <string>),b为字符数组char []
字符串类型转化成字符数组没别的办法,只能一个个字符的赋值,如下 for(int i=0;i<a.length();i++) b[i] = a[i]; b[a.length()] = '\0';
字符数组转化成字符串类型很方便只需要 a = b; 就可, a为string类型(需添加#include <string>),b为字符数组char []