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 <fstream>      
using namespace std;

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

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

    int count_numbers = 0;      

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

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



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


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.