Topical Information

This lab will give you practice with calling library functions (specifically some from the cmath library).

Program Information

Write a program that helps the user calculate the distance between two points in the 2D Cartesian plane. Try to make your results as readable as possible.


As an example, you might have the program interaction look something like (the parts in this color are typed by the user):

$ ./distance.out

                 Welcome to the 2D Distance Program!!!

Where is your first point?  3.4 12.2
Where is your second point?  13.4 12.2

Thank you!!  Calculating...  Done.

(3.4, 12.2) is 10 units away from (13.4, 12.2).

Thank you for using the TDP!!

Endeavor to have a wondrous day!

$

Thought Provoking Questions

  1. What functions will you use from the math library? (Hint: Look at the formula for 2D distance. There should be two DIFFERENT ones.)
  2. How many arguments does each function you are calling accept? What do they mean?
  3. Do the arguments you pass to the function have to have certain names or values? What about types?
  4. How many values are returned from each function you are calling? What do you do with these values?

This assignment is (Level 1.5).


Options


Total Level Possible

If you did all above options, this lab could be worth as much as (Level 2.5).