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");





}

原文地址:https://www.cnblogs.com/qq84435/p/3664833.html