输入一段文字,计算其包含的字符总数

来源:互联网 发布:88读书网软件 编辑:程序博客网 时间:2024/06/05 18:09
//输入一段文字,计算其包含的字符总数#include <iostream>int main(void){    using namespace std;    const int MAX{100};    char buffer[MAX];    char *pbuffer{ buffer };    int count{};    cout << "Enter some words: ";    cin.getline(pbuffer, MAX, '\n');    while (*pbuffer)    {        pbuffer++;        count++;    }    cout << "The number that you input is:" << count << endl;    system("pause");    return 0;}
0 0
原创粉丝点击