CS 159 – HW #01
5 Points Possible
Due: September 6, 2010 at 11:00pm.
Problem: Given the coordinates of two points,
determine the shortest distance between the two points
(green line) and the rectilinear distance (red, blue, and
yellow lines all represent the same distance).
All inputs are integer values.
You are permitted to use mathematical functions for
square root, power, and absolute value as necessary.
Example Execution #1:
Example Execution #2:
Enter the first point: 0 0
Enter the second point: 6 6
Enter the first point: 1 5
Enter the second point: 5 1
Shortest distance between points: 8.49
Rectilinear distance between points: 12
Shortest distance between points: 5.66
Rectilinear distance between points: 8
DO NOT use any material found outside of the first THREE chapters of the C text. Accept input and produce output exactly as seen in the example executions. A program must compile to be considered for partial credit.
Academic Integrity Reminder:
Please review the policies of the course as they relate to academic integrity. The assignment you submit should be your own original work. You should be consulting only course staff regarding your specific algorithm for assistance.
Here are a few of the course standards to remember:
1. Include the head_hw header on top of your assignment (found in your CS159 directory). 2. Indent all code found inside of the main function exactly two additional spaces. 3. Comment all variables (ALL VARIABLES) to the right of where they are defined. When you submit... only the last attempt of a submission is kept for grading. All other submissions are overwritten and cannot be recovered. You may make multiple submissions but only the last attempt is retained and graded.
Assignment deadlines... are firm and the electronic submission will disable promptly as advertised. We can only grade what you submit as expected (including the correct lab section)...
Please join StudyMode to read the full document