| mac193 (6) | |
|
Please help!!!!! The program so far is /* 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. The lowest value found was -9122 End Program. */ | |
|
Last edited on
|
|
| webJose (2947) | |
|
Do your own homework/test. You put something that you have "so far", but I bet all that code was given by your teacher. | |
|
|
|
| mac193 (6) | |
|
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, | |
|
|
|