#include "stdafx.h" #include <iostream> #include <string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { //用字符串数组存放一个字符串 char str1[] = "I am happy!"; cout << str1 << endl; //用字符串变量存放字符串 string str2 = "I am happy!"; cout << str2 << endl; //用字符指针指向一个字符串 char *str3 = "I am happy!"; cout << str3 << endl; system("pause"); return 0; }