统计字符数量为什么总是多一个
// 3.cpp: 定义控制台应用程序的入口点。//
#include "stdafx.h"
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<array>
#include<ctime>
#include<fstream>
#include<cstdlib>
#include<cctype>
using namespace std;
const int strsize = 20;
struct intribute
{
string name;
double money;
};
int main()
{
char ch;
int count = 0;
ifstream inFile;
inFile.open("name.txt");
while (inFile.good())
{
inFile >> ch;
if (isalpha(ch))
count++;
}
cout << count << endl;
return 0;
}
name.txt
abcde