CS201
Lab 3 - Simple C Functions
Objectives:
- Solve a problem using a C program.
Readings:
- Read Chapter 3 in the Hanly/Koffman text.
Deliverables: (DUE BY THE END OF THE LAB!)
- Submittal of your lab3.c and Makefile files.
TO DO (for today's lab)
- Design and Write a program to solve Programming Project #5
on page 142 of the Hanly/Koffman text.
- Use redirection to enter your positive number with
a fractional part. Do not prompt for these values, just read them in from a data file
using
scanf.
- For your input, build a short data file (call it
datain3) that includes only one float
in the first line.
Suppose you wanted to enter 1.449. You would
build a file datain3 that had the following number in line one.
1.449
Make sure to call this file "datain3" and save it to your directory.
- A sample run of your program assuming "lab3" for the name of your
run image would look like the following:
$ lab3 < datain3
- A sample output would look like the following:
bbb1.449 rounded =bbbb1.450
(The b's are blanks)
- The automatic submittal script will expect your output to
be formatted exactly as shown above.
- 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.