标准读入重定向

源程序:

#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char c;
int num=0;
freopen("d:\\test.txt","r",stdin);
while(!cin.eof())0
{
cin>>c;
num++;
}

cout<<"num的值是:"<<num-1<<endl;

return 0;
}

posted @ 2021-12-27 20:01  bobo哥  阅读(29)  评论(0编辑  收藏  举报