123456789101112131415161718 |
- #include <iostream>
- int main6()
- {
- //1、C风格字符串
- //注意事项:1、 char字符串名后加 [] 2、 = 后面要用双引号包含起字符串
- char str1[] = "Hello World";
- std::cout << str1 << std::endl;
-
- //2、C++风格字符串
- //注意事项:包含一个头文件 #include <string>
- std::string str2 = "Hello World";
- std::cout << str2 << std::endl;
- system("pause");
-
- return 0;
- }
|