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 THE NEXT LAB!)
- Submittal of your Algorithm for this lab, lab4.c and Makefile
files.
TO DO (for today's lab)
- Design an algorithm to solve Programming Project #6
on page 205 of the Hanly/Koffman text.
- Write a program in C to implement the algorithm designed in the above step.
- Your program should take input as 3.0 -3.2 as x and y coordinate values.
- Your program should also use a loop to input coordinate values, and should stop taking input once the coordinate values for the origin (0.0, 0.0) is entered.
- A sample output of your program would look like the following:
(3.0,-3.2) is in
quadrant
IV
- Some other possible outputs are as follows:
(3.0,0.0) is
on the x axis
(-0.0,0.0) is on the origin
(-2.5,1.9) is in
quadrant II
- Whenever designing your solution, consider that the likelihood of having the coordinate values as input are as follows
Your program should also output the number of conditions checked before a true condition is reached. The grading will be depending on the number of conditions tested by your program before reaching to a true condition considering the likelihood. The fewer comparison, the better the grade will be.
- Remember the discussion in Lecture 8 about comparing double values and use those ideas accurately in your comparison.
- Properly document your code and follow all code conventions discussed in the class.
- If you finish your assignment during the lab session, call your TA, hand in the printed algorithm and get checked off instantly.
Grading Scheme
Algorithm (Either in a separate text file or at the beginning of your source code as documentation) 20%
Program compile and execute as specified 30%
Program meets all specifications 40%
Program follow code conventions and contain proper documentation. 10%
No Enrichment this week