C++和C在字符串的定义有一定的区别的
#include#include #include //c++中字符串需要添加这个头文件 using namespace std; int main() { char str[] = "Hello C string"; cout << str << endl; string strc = "Hello C++ string"; cout << strc << endl; system("pause"); return 0; }

C++和C在字符串的定义有一定的区别的
#include#include #include //c++中字符串需要添加这个头文件 using namespace std; int main() { char str[] = "Hello C string"; cout << str << endl; string strc = "Hello C++ string"; cout << strc << endl; system("pause"); return 0; }