字符总数
Coddy 用 C++ 编写简单的字符计数器 课程的第 3 课,共 5 课。
挑战
简单现在,你已经获得用户的输入,请统计字符串中的字符数,并按以下格式输出(换行):
Total characters: XX不包括空格。
删除上一课中用户输入的输出。
亲手试试
#include <iostream>
#include <string>
using namespace std;
int main() {
string text;
cout << "Enter text:" << endl;
getline(cin, text);
cout << text;
return 0;
}用 C++ 编写简单的字符计数器中的所有课
自己练习: C++ 在线编译器
统计任意文本的字数: 字数统计