Homework 3

The homework is due on Wednesday, May 3, 2006 at 5pm.
Due to the power outage, you can submit the homework through Thurs. May 4 at 5pm.

Name your files hw03_<problem>.cpp. Email all files to my Helios account.

  1. This purpose of this problem is to work with function overloading. You will write several versions of a function call find_min(), a function called get_input() and a function called print_min(). From within main, call each version of get_input() and find_min() in turn and call print_min() with the result of find_min(). For example, you will call get_input() with two integers, find_min() with two integers and then print_min() with the result of find_min().
  2. From the book, programming project 5.13 on page 296:
    The area of an arbitrary triangle can be computed using the formula area = sqrt( s(s - a)(s - b)(s - c) ), where a, b, and c are the lengths of the sides and s is the semiperimeter. s = (a + b + c)/2. Write a void function that uses five parameters: three value parameters that provide the lengths of the edges, and computes the area and perimeter (not the semiperimeter) via reference parameters. Make your function robust. Note that not all combinations of a, b, c produce a triangle. Your function should produce correct results for legal data and reasonable results for illegal combinations.