solo6_template.cpp
/* Enter your information here */
#include <iostream> // for streams
#include <fstream> // for files
#include <cstdlib> // for exit
using namespace std;
int main()
{
char fileName
[13];
int input, largest, smallest;
cout << "Enter a file name. This Program limits
file names to"
<< endl
<< " a maximum of 12 characters. " << endl;
cin >> fileName;
//get the name of the external file
ifstream infile;
//declare internal (to program) name of the input file
infile.open(fileName);
//Check to see if we were able to open the file, if
not get out
if(!infile)
{
cout << "Cannot
open file " << fileName
<< " Aborting program " << endl;
exit (1);
}
//read in the first line of the file
infile
>> input;
//initialize largest and smallest
largest = input;
smallest = input;
while( ! infile.eof())
//process each line until end-of-file is reached
{
*** Your code here ***
infile >> input;
//get the next line
}
cout << "smallest in file = " << smallest
<< " largest in file = " << largest << endl;
infile.close();
return 0;
}