CS201
Lab 4 - Simple C Selection
Objectives:
- Solve a selection problem using a C program.
Readings:
- Read Chapter 4 in the Hanly/Koffman text.
Deliverables: (DUE BY END OF LAB!)
- Submittal of your lab4.c and Makefile
files.
TO DO (for today's lab)
- Design and Write a program to solve Programming Project #6
on page 205 of the Hanly/Koffman text.
- Use redirection to enter your x y coordinate pair.
Do not prompt for these values, just read them in from a data
file using
scanf as you did the last time.
- For your input data file build a short file with two
floats in the first line. (Assume all numbers have one
decimal place precision.)
Suppose you wanted to enter an x, y of
3.0 -3.2. You would
build a file that had the following numbers in line one.
3.0 -3.2
Call this file datain4 and save it to your directory.
- A sample run of your program assuming "lab4" for the name of
your
run image would look like the following:
$ lab4 < datain4
- A sample output would look like the following:
(bbb3.0,bb-3.2) is in
quadrant
IV
- Some other possible outputs for various numbers follows:
(bbb3.0,bbb0.0) is
on the x axis
-
(bb-0.0,bbb0.0) is on the origin
(bb-2.5,bbb1.9) is in
quadrant II
- The automatic submittal script will expect your output to
be formatted exactly as shown above. The b's are
blanks.
- You do not need to submit your sample data file. I will provide
a set of test data files for the automatic script to use to
test your program.