Date: Mon, 11 Nov 1996 17:13:18 GMT
Server: NCSA/1.5
Content-type: text/html
Last-modified: Wed, 11 Sep 1996 21:37:48 GMT
Content-length: 3481
Program 1 - CS 302 Fall 1996 - Section 4
Algebraic Language Programming in C++
Instructor:
Milo M. Martin
(milo@cs.wisc.edu)
Program 1
Due Wednesday, September 18, 1996
In program 1 you will be writing your first program. You may write on
your program to execute one of the following three formulas:
- Conversion from degrees Celsius to degrees Farenheit
F = ((9.0/5.0)*C)+32
- Conversion from degrees Farenheit to degrees Celsius
C = (F-32)*(5.0/9.0)
- The volume of a sphere
V = (4.0/3.0)*PI*r3
For this assignment, all input comes from the keyboard and output is sent
to the display. Remember to prompt for and read the necessary input
variables. It is also a good idea to check your results with a calculator
to make sure you don't have any logic errors! The calculations should be
done using double variable types. The answers should be
displayed only with a reasonable number of decimal places.
You should use your U:\PROGRAMS\PROG1 directory to hold the
files for this assignment.
Turn in the assignment following the guidelines given in Turning in Assignments. Turn into me a print out of
your code and a number of test runs. Staple all of your pages together.
See below on how to print out your output. To avoid mixing up your output
with others, at the beginning of your program, have it print your name and
section using cout.
Commenting Your Program:
Comments are required for this and all subsequent programs. They are used to
document your program, but are ignored by the compiler. As you develop your
program, comments are added for clarification and explanation. In C++ comments
follow after // and continue only to the end of the line. You may also use C
comments, which are between /* and */ and can span several lines. Comments are
found at the top of the program, including:
- Your name
- CS302, section 4
- Instructor: Milo Martin
- Program number
- Due date
- A general description of the program
- This description should tell what the program does and how to use
it. Also mention any limitations, unresolved bugs, or special features
of the program.
In the code place comments: - After any constants or variables for
which it would not be clear what they are used for to someone who does not
know what the program does.
- To label and briefly explain the main steps of the algorithm with
comments.
- By any unclear or convoluted code to explain it's purpose.
Printing Your Output
After your program has finished is should say "inactive" at the top of the
output window. When it says this, click on the upper lefthand corner of
the window to activate a pull down menu. Select Print from this
menu, then click ok.
Created by
Dan Yao
, Dave Zimmermann
& Milo Martin