(Latest Revision: 09/21/2001)
(09/21/2001: Added information about printing backslash characters.)
FIRST CS 1500 SOLO PROGRAM
Making ASCII Heads with Functions
PRELIMINARIES:
You need to learn about program design, structure charts, functions,
and basic C++ program structure before starting this assignment. To
do that, read the first chapter of
Shiflet.
THE ASSIGNMENT:
This assignment is similar to, but different from, problem #3 on page
39 of Shiflet.
You will write a program that prints some "ASCII art."
Specifially you will design a structure chart and write a program that
has two functions besides main, called Head_One and Head_Two.
The Head_One function must print this pattern:
//////\\
/ \
_| _ _ |_
|.|-(.)-(.)+.|
\| J |/
\ --- /
\ /
"####"
and Head_Two must print this pattern:
-------+ \
\\\\\\\\\ \
//_//__\\\ |
/\0' `0~ |\ /
(|^<, ^ .)|
( ._. ||/
\ . / |
+--/ |
The main function in your program must print both heads twice in an
alternating fashion going down the page like this:
//////\\
/ \
_| _ _ |_
|.|-(.)-(.)+.|
\| J |/
\ --- /
\ /
"####"
-------+ \
\\\\\\\\\ \
//_//__\\\ |
/\0' `0~ |\ /
(|^<, ^ .)|
( ._. ||/
\ . / |
+--/ |
//////\\
/ \
_| _ _ |_
|.|-(.)-(.)+.|
\| J |/
\ --- /
\ /
"####"
-------+ \
\\\\\\\\\ \
//_//__\\\ |
/\0' `0~ |\ /
(|^<, ^ .)|
( ._. ||/
\ . / |
+--/ |
The main function must do this by alternately
calling functions Head_One and Head_Two two times each.
You must do this assignment with functions in the manner
specified above. The heads you use in the program must be exactly
like the ones shown, in every way. (If you work smart with your
editor, this can be very easy. Ask me for some hints in class.)
To refamiliarize yourself with the basic steps required for doing a
programming assignment, please refer to the
directions for the Hello World! sample programming assignment.
To see some sample code similar in structure to what you need to make
for this assignment, see
useFunction.cpp
and
ex0102.cpp
Note About A Small Glitch: As we discussed in class, some of
the characters in the figures above are "backslashes" like these:
\\\\\
The backslash has a special meaning as an escape character, and so you
must use the escape sequence \\ for each single backslash you want to
print. For example,
cout << "\\"
prints one single backslash, and
cout << "\\\\"
prints just two backslashes.
WHAT TO TURN IN:
You will be sending me two e-mail messages. Please follow
these rules:
- Always send me e-mail as plain text in the main message body.
Never send me attachments.
- Always use the exact subject line I specify for
each message. (I get hundreds of e-mail messages at a
time and your subject line allows me to sort messages.)
- Be very careful when typing the command to send e-mail.
You may use the instructions in your
Hello World! lab excercise
for guidance.
- Always send yourself a copy of each e-mail message you
send to me, and check immediately to see if you
receive the message intact. You are responsible
for sending e-mail correctly.
Send the following items to me by e-mail before midnight on the
due date :
- A copy of the source code (C++ code) with subject line:
CS1500,prog1.f, and
- a script showing a test run of the program, with subject line:
CS1500,scrp1.f .
Note that there are no spaces in the subject lines given. It is
important that you do not insert any spaces. My e-mail address is:
john@ishi.csustan.edu.
DUE DATES:
For the due dates, see
the class schedule.
Note: I didn't create the art I used for this assignment. I got it
here.
You can find lots of examples this kind of art by searching for "ascii
art" with a search engine.