CS 1320 (Principles of Algorithm Design I):
Homework #2

Assigned:
September 15, 1999
Due:
September 22, 1999, at start of class. (New due date: September 24, 1999.)
Credit:
30 points.

Programming problems

Credit:
10 points each.
Instructions:
Write a C++ program to solve each of the problems below. See the guidelines for programming assignments for what to turn in. Your code should begin with comments that describe what the program is supposed to do (not how it does it, but what it does -- i.e., its input and output). See the sample programs for examples.

Problem: Largest and smallest numbers

Write a program to compute and print the following:

Seconds to years, etc. conversion

Write a program that prompts the user for a number of seconds S (S should be a non-negative integer) and prints S in a more normal notation -- years, days, hours, minutes, and seconds. You may ignore leap years and seconds. For example, 100 seconds is 1 minute and 40 seconds. (You may be interested to run this program using successive powers of 10 as input and see how long it takes before seconds start to add up to years.)

Temperature conversion, revisited

Modify the program you wrote in Homework #1 to convert Fahrenheit to Celsius as follows: