For some reason im getting stuck in a loop after i enter in my "numberinput"
i have a mimic case that does the same thing but with characters instead of numbers, and it seems to work perfectly
all this is doing is checking to see how many times the user defined number is inside a premade file.
case '2':
infile.open("numbers.dat");
if (infile.fail())
{
cout << "Error opening input file -- program terminated!\n";
return 0;
}
//number input
cout << "\nEnter number to count: ";
cin >> numberinput;
cout << endl;
//priming read
infile >> number;
//looping count
while (!infile.eof())
{
if (number == numberinput)
{
count++;
infile >> number;
}
else
{
infile >> number; //reset read
}
}
cout << "\nThere is/are " << count << " occurence(s) of that number in the file.\n";
count = 0;
//file close and clear
infile.clear();
infile.close();
break;