COSC 1435 Lab 9
This lab explores opening and using numeric data from a file.
Before class on April 8, 2013
Do the following:
1. Write a program
that will do the following:
- Open a disk file that contains
an unknown number of integers. The file the grader tests with will have different
numbers than the test files, but there will be white space between each number.
- Read in each number from the file,
one at a time, processing them as each is read in. The number you read in
does not need to be saved after it has been processed. Here are three test
files that you can use to test your program: integers1.txt,
- For these numbers in the file
you will be doing the following:
- Print each number to the console,
with a space in between each. Do not worry about line overflow.
- Counting the numbers in the
- Finding the sum of the number
in the file.
- Find the high and low value
in each file and the numeric position of each.
- Finding the average of all
the numbers in the file.
- When the end of file is reached,
print a message that says "End of File".
To assist you in building this
program, use the fileIn.cpp program I wrote in class. We will review this
at the start of the lab.
lab requires a lab report/documentation package. All of these items are not
typically in the same file (source code and sample output should definitely
be in their own files), but the main lab report file must reference each item
by file name. Here is a sample lab report. The
main lab report must either be a text file (with a .txt extension) or a Microsoft
Word file (with a .doc or .docx extension). The lab report must includes the
following or references (the file name that was attached to the mail) to the
source code (do not include the source code in the program documentation,
only give the file name for the source code)
with sample data, from all three test files. The output must be from the
clst.tamucc.edu Linux server, not from Windows.
How was this
program tested, including the test values you put into the program to
verify that it worked properly for all types of cases within the program
did you have with this program?
of how much time you spent working on this lab
Submission. You will be submitting this
lab via Blackboard. The teaching assistant will provide further instructions
on how to accomplish this. Prepare the following:
source code. This file should be called lab09***.cpp, where the ***
is replaced with your initials.
A copy of
your program output saved as a file. This file should be called lab09***.txt,
where the *** is replaced with your initials. The .txt signifies that
this is an ASCII text file.
A lab report
as described above. The lab report may be in a Microsoft Word document,
with a .doc suffix or an ASCII text file with a .txt suffix. Make
sure it contains all of the required items. This file should be called
either lab09***doc.txt for a text file or lab09***doc.doc for a Microsoft
Word file, where the *** is replaced with your initials.
Submit via blackboard following
the instructions given during the lab.
Criteria: 100 points available for this lab.