字符串的输出:cout ▣法一:单个元素单个元素输出→循环(数组方式) char str[20]="C++and Matlab"; for(int i=0;i<20;i++) if (str[i]!='\0') cout<str[i];/∥逐个输出 else break; 口法二:整体输出cout ex05_str_cout.cpp char str[20]="C++and Matlab"; cout<str<endl;/∥整体输出 注:输出字符中不含"0 4 http://math.ecnu.edu.cn/~jypan http://math.ecnu.edu.cn/~jypan 字符串的输出:cout 4 法一:单个元素单个元素输出 循环(数组方式) char str[20]="C++ and Matlab"; cout << str << endl; // 整体输出 char str[20]="C++ and Matlab"; for(int i=0; i<20; i++) if (str[i]!='\0') cout << str[i]; // 逐个输出 else break; ex05_str_cout.cpp 注:输出字符中不含 "\0" 法二:整体输出 cout