Computer Science 105 Assignment 7 - High Level Languages and C++
Programming
Due: 5:00pm October 31, 2003
Objectives and Overview: This assignment introduces the elements
of C++ programming. The key challenge here is, "How do software
designers write programs for real applications, and how are they
translated (compiled) to run on a computer?" The readings and exercises
for this assignment are taken from portions of chapter 7 of your text.
Part 1 - Compiling and Running a C++ Program
Drag a copy of the Invitation
folder from the csci105 server
to the desktop, and then close the csci105
folder. Double-clock the icon
Invitation (OSX) that is iside the folder Invitation on your
desktop and activate the familiar orange menu. The button C++
Compiler
is used for this assignment. When you select it, Open the
file
fig12.cpp in the Desktop -> Invitation -> Examples
directory, and then select
Compile in the Compiler menu. The following result should
appear
on your screen.

This window has two columns. On the left is a listing of the
original C++ program and on the right is a copy of that program that
has been checked for errors and "compiled," or translated into machine
code. (The actual machine code itself doesn't appear here.)
Now select Execute in the Compiler menu, and then select the
Run button at the bottom -- you will be prompted to enter two
4-digit numbers. This program should behave just like the
pseudocode algorithm that we first saw in Figure 1.2, but now it's been
rewritten in C++. You should be able to duplicate the output
shown below.

Now open, compile, and run the program "fig25.cpp" in the EXAMPLES
folder.
1. Describe briefly in English what this program does.
Now open, compile, and run the program "fig29.cpp" in the EXAMPLES
folder.
2. Describe briefly in English what this program does.
Now open, compile, and run the program "fig210.cpp" in the EXAMPLES
folder.
3. Describe briefly in English what this program does.
Part 3 - Algorithmic Problem Solving
Complete your answers to the above three questions, and then complete
Exercises 2, 5, 6, 11, 14, 19, 22, and 24 on page 367 of your
text. All of these can be handwritten except for Exercise 24,
which should be written and
run correctly using the C++ Compiler described above.
Submit your completed program to the csci105 -> Drop Box
when you have completed it.
You may do these exercises (except the last one) either by hand or with
a word processor. Also, you may choose to do this assignment either by
yourself or in teams of two. If you work with someone else, your
team may hand in one copy of the completed assignment with both names
at the top.
Part 4 - Submitting Your Work
To submit a file electronically, remember to rename it so that you are
identified as the author (e.g., give it a name like asst7atucker).
Then drag the file to the csci105 -> Drop Box folder.
Once you are finished in the lab, be sure to drag the CS105icon
to the Trash - this step disconnects you from the server and
prevents someone else (who may use this iMac later in the day) from
accidentally accessing files in your personal folder.
To submit a handwritten assignment, leave it in the CS105
mailbox near my office (Searles 220).