自考新教材-p292

源程序:

//

//  main.cpp

//  p292

//

//  Created by duanqibo on 2020/1/27.

//  Copyright © 2020年 duanqibo. All rights reserved.

//

#include<iostream>

using namespace std;

int main()

{

    int n=0;

    char ch;

    while((ch=cin.get())!=EOF) //当文件没有结束时继续进行循环

    {

        cout.put(ch);

        n++;

    }

    cout<<"输入字符共计:"<<n<<endl;

    system("pause");

    return 0;

}

 运行结果:

原文地址:https://www.cnblogs.com/duanqibo/p/12236053.html