Not reading double values from the text file in C++

There are some space separated double values given in a text file. The constraint is that only "n" numbers must be read from the text file iff number of elements present in the text file are greater than "n". if numbers present in the text file are less than "n", then simply read all the values from the text file and simply exit ( without caring the value of "n" ). Now, I have written this code :

#include<iostream>
#include <fstream>      
using namespace std;

int main() 
{
    ifstream File;              
    File.open("numbers.txt");       

    int n;
    cout<<"Enter n : ";
    cin>>n;

    int count_numbers = 0;      

    while(!File.eof() )     
    {
        double num;     
        File >> num;    

        cout<<"num = "<<num<<"\n";
        cout<<"count = "<<count_numbers<<"\n\n";

        if(count_numbers>=n)            
        break;

        count_numbers++;        
    }

    cout<<"count value = "<<count_numbers<<"\n";

    File.close();       
}

There are total 4 space separated values present in the text file :

values in "numbers.txt" = 1.2 4.5 3 2.7

And when i am trying to read 8 values ( Means n = 8 ) , It should read only 4 values of the text file because 8>4. But it is giving me a weird result. Like this :

enter image description here

Kindly do the needful.