CS 1500-1, Spring 2008
Solo Program 6



OBJECTIVE:

Search a file of numbers of type int and write the largest and smallest to the screen. The file contains int values delimited by white space or newline characters.


THE ASSIGNMENT:

Your assignment is to write a program that searches a file of numbers of type int and write the largest and smallest to the screen.

To do this you will need to:

1.  Declare an array of characters to hold the file name input by the user:
    char fileName [13];

2.  Check that the file can be opened and exit it not.

3.  Process the file, one integer at a time (while(not EOF)), keeping track of the smallest and largest values seen so far. Output the smallest and largest values once all of the integers in the file have been processed.


INPUT AND OUTPUT:

The program must prompt the user to input a file name.

The program must open and read a file containing int values delimited by white space or newline characters. The program will output the smallest and largest values in the file.
Here are sample contents of a data file, called data1:

333333
-1
4444444
-22
55555555
-1
-333
999999
-4444

How it should look when you run the program:

mmartin@cs.csustan.edu:(~/cs1500/solo6) g++ solo6.cpp 
mmartin@cs.csustan.edu:(~/cs1500/solo6) a.out

Enter a file name. This Program limits file names to  a maximum of 12 characters.
data1

Smallest in file = -4444
Largest in file = 55555555


WHAT TO TURN IN:

Here is the list of things you have to turn in:
DUE DATES:

For the due dates, see the class schedule.