/* TODO: Write the declaration (prototype) for void function GetLeast that takes an ifstream parameter called infile as an input parameter that is changed, and that has an int parameter called lowestthat returns a value.
Document the data flow for the parameters with appropriate comments.
*/
int main()
{
int smallestValue = INT_MAX; // Initialize smallest to maximum range
ifstream dataFile; // File input stream
const string filename = "data.txt"; // Input file name
cout << "Opening file...";
dataFile.open(filename.c_str()); // Open file
if(dataFile) // File opened OK?
{
cout << "file opened." << endl
<< "Begin searching for lowest value...";
/* TODO: Call function GetLeast, passing the ifstream variable
and int variable as arguments.
*/
cout << "done.\n" << endl; // Print result
cout << "The lowest value found was "
<< smallestValue << endl;
}
else // Problem opening file
{
cout << "could not find or open file: " << filename
<< endl;
}
dataFile.close();
cout << "\nEnd Program.\n"
<< endl;
return 0;
}
/* Sample program output:
Opening file...file opened.
Begin searching for lowest value...done.
Haha, I suppose I did deserve that.
I should have specified, the first TODO: when it talks about adding an ifstream parameter as an input parameter i'm not sure how to do,