在该c++文件的前面加上 #include <cstdio>即可
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char ch;
int count = 0;
cout << "Enter characters:" << endl;
ch = cin.get();
while(ch != EOF)
{
cout.put(ch);
count++;
ch = cin.get();
}
cout << count << " characters read!" << endl;
return 0;
}