Overview:
This assignment introduces the idea of
abstraction in problem solving using the C++ idea of a function as a
medium. The key challenge here is, "How do software designers organize
large programs, and how do the parts of these programs communicate
with each other when they are running?" The readings and exercises for
this assignment are taken from section 7.7 of your text.
Notice here that the program has two parts, a main program and a
function definition named
Now select Execute in the Compiler menu, and then select the Run button at the bottom -- you will be prompted to enter a series of numbers.If you enter the series of numbers 8 7 6 9 4 0 you should receive the following output.
When the main program begins to run, the first statement
executed is
Now look at the function definition getArray, which begins with
the line You should carefully review the discussion of C++ functions in
section 7.7 before answering the questions in this lab. Additional
examples of simple C++ programs with functions are called
EXAMPLE6.CPP - EXAMPLE9.CPP in the Invitation -> EXAMPLES
folder on your desktop. You may want to run some of these to get a
better feeling for writing and running programs with functions.
The Cryptography problem
Load crypt_decode.cpp and crypt_encode.cpp programs from the EXAMPLES
directory and write the encode/decode function that is missing. Work
with your team!
You may do these exercises (except the last one) either by hand or
with a word processor (e.g. MS Word). Also, you may choose to do this
assignment either by yourself or in a group. However, solutions should
be written up individually and handed in on the due date.
To submit a file electronically, you should first rename it so that
you are identified as the author (e.g., give it a name like
lab-x-ltoma). Then drag the file to the csci107 -> Drop
Box folder. Be careful not to drag an entire folder into the
Drop Box; only a single file at a time can be submitted.
Once you are finished in the lab, be sure to drag the CS107 icon 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. Algorithmic Problem Solving
Complete practice problems 1-3 on page 347 of your text, and then
complete Exercises 27, 29 and 30 on page 369 of your text. All of
these can be handwritten except for Exercise 30, which should be
written and run correctly using the C++ Compiler described
above. Submit your completed program to the csci107 -> Drop Box
when you have completed it.