C++primer plus第六版课后编程题答案 6.8
//6.8
#include<iostream>
#include<fstream>
using namespace std;
void main68()
{
ifstream inFile;
ifstream fin;
int count=0;
inFile.open("2.txt"); //请将文本文件放到当前路径
if(!inFile.is_open())
{
cout<<"Open Failed!"<<endl;
}
char ch;
inFile>>ch;
while(inFile.good())
{
count++;
inFile>>ch;
}
if(inFile.eof())
{
cout<<"count="<<count<<endl;
}
system("pause");
}

浙公网安备 33010602011771号