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

Assigned:
September 8, 1999
Due:
September 15, 1999, at start of class.
Credit:
25 points.

Creating your CS account

Credit:
5 points.
Instructions:
  1. Create your account on the CS machines, following the instructions in the CS1320 FAQ.
  2. Send mail to bmassing@trinity.edu from your CS account. The message should contain (a) your full name, and (b) your preferred e-mail address. If you do not know how to send mail from Unix, the following will accomplish the desired result:
    1. Use a text editor to compose your message. Save it in a file, say mymessage.
    2. Send the file with the following command:
      mail bmassing@trinity.edu < mymessage

Programming problems

Credit:
10 points each.
Instructions:
Write a C++ program to solve each of the problems below. 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. See the guidelines for programming assignments for what to turn in.

Problem: Temperature conversion

Write a program to convert a Fahrenheit temperature to Celsius. The rule for converting Fahrenheit temperature F to Celsius temperature C is: C = (5/9)(F - 32) . The program should ask the user for the Fahrenheit temperature and print the equivalent Celsius temperature. You can use integers for this problem, since we have not yet discussed floating-point numbers.

Problem: Number sequence

A sequence begins 0, 1, 1, 2, 3, 5, 8, 13. Write a program producing the first thirty entries in this sequence. (You will need to figure out the rule for producing the next entry from the preceding entries.)