// Mr. Minich
// CMPSC 101
// Ch. 5 Demo Program #6
// January 30, 2000
// Purpose - to demonstrate searching a file for a specific number.

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

int main()
{
   int nextNum = 0;
   int num = 0;
   bool found = false;

   cout << "Enter the value that you'd like to find: ";
   cin >> num;

   ifstream infile("data.txt");

   while (!infile.eof() && found == false)
   {
      infile >> nextNum;

      if (nextNum == num)
      {
         found = true;
      }
   }

   if (found == true)
   {
      cout << "I found your number in the file" << endl;
   }
   else
   {
      cout << "I did not find your number in the file" << endl;
   }

   infile.close();

   return 0;
}// end of main