I want to read a file and see if there are either 1 or 2 numbers in it. and if those 1 or 2 of the numbers are not in the file, then I want to ask the user to enter them.
I am using the following code:
ifstream fin;
while (!fin.eof())
{
    fin >> x;
    counter++;
    fin >> y;
    counter++;
}
switch (counter)
{
case 0:
    cout << " Enter the 1st number";
    cin >> x;
    break;
case 1:
    cout << " Enter the 2nd number";
    cin >> y;
    break;
default:
    break;
}
But if for example, one of the numbers are not in the file, I get an uninitialized value instead.
 
     
    