c++primer清单里的,我自己写出来不一样


#include <iostream>
#include<fstream>
#include<cstdlib>
using namespace std;
const int Size = 60;
int main()
{
    char fli[Size];
    ifstream yyy;
    cout << "Enter name of data file: ";
    cin.getline(fli, Size);
    yyy.open(fli);
    if (!yyy.is_open())
    {
        cout << "Could not open the fli ";
        cout << "Program terminating.\n";
        exit(EXIT_FAILURE);
    }
    double value;
    double sum = 0.0;
    int count = 0;
    yyy >> value;
    while (yyy.good())
    {
        ++count;
        sum += value;
        yyy >> value;
    }
    if (yyy.eof()) {
        cout << "end" << endl;
    }
    else if (yyy.fail()) {
        cout << "mismatch\n";
    }
     else {
        cout << "unkonwn\n";
    }
    if(count==0)
    {
        cout << "no date\n";
    }
    else {
        cout << double(count) << endl;
        cout << (double)sum << endl;
        cout << double(sum) / count << endl;
    }
    yyy.close();
    return 0;

}
我在目录里创建了一个txt文件内容为:18 19 18.5 13.5 14 
16 19.5 20 18 12 18.5 
17.5
按理答案是:count=12
sum=204.5
平均为17.0417
我哪里写错了