Our Second Programming Assignment
The goal of this assignment is for you to complete the program
we started writing in class, compile it and run it.
The Assignment:
-
Type in the program
exactly as you see it. You can even cut and paste, if you can figure
out how to do it.
-
Save the program as namegame.c
-
Make changes in the two places indicated. See below for some pointers
-
Compile it. (g++
namegame.c)
-
To run the program, type a.out
at the command prompt.
Some Pointers
-
The characters "||"
mean "OR" So the expression "this
|| that" for example, returns true if either this or that
is true, or both.
-
The phrase "break"
inside of a loop causes the program to exit the loop at that point, even
if the loop wasn't "done" yet. The "for" loop in the program has
a "break"
in it which causes us to exit the loop as soon as we find the vowel.
-
The name game works as follows: The user enters a name, such as "Robert,
" The output is:
-
Robert, Robert, Bo Bobert
-
Banana, Fana, Fo Fobert
-
Fe, Fi, Mo Mobert
-
Robert!
-
The "root" which gets repeated from line to line is the portion of the
name beginning with the first vowel found in the name.
What you should turn
in:
At a command prompt, type the following
line
whoami | a.out | lpr
This should generate a printout,
which is what you need to hand in on Tuesday.
Note that this will print out in
the Austin lab, even if you are doing it from home.
Again, you need to remember that only the computers near the wall will
print.
Hopefully, this will be fixed soon.