Date: Mon, 11 Nov 1996 17:13:24 GMT
Server: NCSA/1.5
Content-type: text/html
Last-modified: Fri, 06 Sep 1996 06:52:56 GMT
Content-length: 4428
Program 0 - CS 302 Fall 1996 - Section 4
Algebraic Language Programming in C++
Instructor:
Milo M. Martin
(milo@cs.wisc.edu)
Program 0
Due Wednesday, September 11, 1996
Objective: Program 0 is designed to give you practice editing,
compiling, executing, modifying, and documenting a program. This program
is not graded, but is required to receive a passing grade in the class.
Before doing this assignment you may want to some
review the help documents from the CS302 home page, such as the
introduction to
Microsoft Windows and Borland C++
.
Do the following exercises:
- Create your program directories. To do this, start the File
Manager, select the Copy... option from the File menu.
In the next window enter the following in the ``From:'' field,
"R:\PUBLIC\MILO\PROGRAMS", In the ``To:'' field, enter
"U:\".
- Do problem 1-1, page 33 (chapter 1, problem 1): Enter and run the
program from Display 1.8, on page 21 of the text. When entering the
program, pay close attention to the indentation of the lines of the
program.
- Do problem 1-2, page 33.
- The program as presented has no comments or other documentation.
Add header documentation (comments at the top of a source file) which
contains the program title and number, your name, section, instructor,
etc. Any characters on a line after // is a comment, and words
between /* */ are also comments. This last kind of comment
works across multiple lines.
- Turn in the assignment following the guidelines given in Turning in Assignments.
Borland C++ 4.5 Hints
Start Borland C++ 4.5 which is found in the CSApps program
group. Make sure you are using 4.5 instead of 4.0 -- your CSApps
program group may contain both. When you have Borland up and running,
you want to first create a file to write your program in. You click on
File in the left corner of the screen, and choose New
within the menu that drops down. An empty box will appear on your
screen; this is where you will write your program. You will want to save
your programs often. The first time you save it, choose Save as
within the File menu. Click on the folders in the box on the
right so that you will be saving the file in "U:\PROGRAMS\PROG0".
For the name of the file, enter "PROG0.CPP". The .CPP
lets you know that it is a C++ source file. The second time you save,
you can just choose Save, and it will be done automatically. To
access a file that you have previously saved to the disk, simply choose
Open from the File menu, changing to the desired folder,
and then selecting the file.
Once you have the program typed into the file window, and you have saved
the program in case something unsavory happens, then you just need to
press the little lightening bolt button near the top of the screen. Your
program will be compiled, linked, and run. If you made a typing
error, chances are you will get a syntax error. Go back to the program,
check your typing, and when the mistake is found, change it and run the
program again.
When the program runs, it will create a window, and prompt you for the
program input. When the program is done the word ``interactive'' appears
in the title bar. After the program finishes, you can close the window it
created by double clicking on the upper-left corner of the window.
Milo M. Martin
(milo@cs.wisc.edu)