CS 1323 Section 30, Spring 1997
Individual Project 7
Deviations
Due Monday, April 21, 3:30pm
What to Hand In
Project Description
Write a program that retrieves a sequence of numbers
from the keyboard and displays on the screen the deviations of those
numbers from their average and the relative positions
of the numbers within
their range, on a scale of zero to one.
To compute the average of the numbers,
use the calculation method of the arithmetic mean function
in the NumericUtilities module (accessible from the
Supplied Software page of the class website).
That is, incorporate each successive number into the
running average of the previous numbers.
The range of a collection numbers is bounded by the
smallest and largest of the numbers.
The relative position of a number x within
the range low
<= x <=
high is
(x - low) / (high - low).
Compute the range of the numbers retrieved from the keyboard by
finding the largest and smallest of them.
Ground Rules
- Use aspects of C described in Lessons 1-5,
6-8, 9-13, 15, and 36 of the Winston text.
This does not include arrays.
- The program must not restrict the length of
sequence of numbers it retrieves from the keyboard.
It should accept numbers until the person at the
keyboard signals the end of the sequence (control-d
on Unix - see Lesson 13 in the Winston textbook on C).
- Your program can compute the average and range of the
numbers as it retrieves them from the keyboard.
To compute the deviations from the average and
the relative positions,
the program will need to make a second pass over
the data. The program can record the numbers in
a file to make a second pass over the data
possible.
- Define functions compute the deviation of a number
from an average and the relative position of a
number within a range.
Put the functions
in their own module and import them into the main
module.
Use the functions in the
the appropriate part of your
program.
- You may find it helpful to know that the fscanf
function, besides retrieving data from a file,
delivers, as its value,
the number of input items retrieved.
- Read the
Code of Conduct
for ground rules that apply to all
projects.
- The paper you submit must conform to the
C Project Style Guide.
CS 1323 Section 30 - Fundamentals of Computer Programming -
Spring 1997
Instructor:
Rex Page
(Email: page@ou.edu)
Up to: Welcome Page ~~~
Up to: University of Oklahoma ~~~
Go to:
Next Semester ~~~
Go to:
Previous Semester