Our Take-Home Exam--Part 1 of 2
(This is not the Final Exam)
The Setup:
Here is a complete,
working version of your last programming assignment, with
Checking the Name and Finding the First Vowel are relegated
to two functions
in the program.
If you compile this program and run it with the command:
cat names.txt |
a.out
then you get the following output:
(This was initially put up here incorrectly,
but now it's right.)
Enter a name:
Billy, Billy, Bo Billy
Banana, Fana, Fo Filly
Fe, Fi, Mo Milly
Billy!
Enter a name: Enter
a name: Enter a name:
Ansel, Ansel, Bo Bel
Banana, Fana, Fo Fel
Fe, Fi, Mo Mel
Ansel!
Enter a name:
Quincy, Quincy, Bo Buincy
Banana, Fana, Fo Fuincy
Fe, Fi, Mo Muincy
Quincy!
Enter a name: Enter
a name:
Shrshen, Shrshen, Bo
Ben
Banana, Fana, Fo Fen
Fe, Fi, Mo Men
Shrshen!
Enter a name:
done, done, Bo Bone
Banana, Fana, Fo Fone
Fe, Fi, Mo Mone
done!
What You Should Do
-
Save the program as "finalgame.c"
-
Fix the program so that there is a line of space between the name games.
For example, there should be a line of space between "Quincy!"
and "Enter a name:"
above.
-
Create a function called "PlayNameGame"
and move all of the "cout"
commands (which print the game) out of "main()"
and to that function. The prototype / declaration for this function
could look like: void
PlayNameGame();
What you should turn
in:
-
First, make sure you have the
file called "names.txt"
from the previous assignment.
-
You can test your program/file by typing cat
names.txt | a.out
-
When your program is working, email the program to me. To do this,
type
-
mail hochberg@cs.ecu.edu < finalgame.c
-
NOTE:
It seems that mail is working only from the computers near the wall (the
same ones from which you have to print). So make sure you use one
of those computers when you issue the "mail"
command above!
-
Note: I will send an email back to your csci account to let you know
I received your submissions. If you don't get that within 24 hours,
please call me. Also, feel free to call my office to see if I received
your program (328-0126)
Our Take-Home Exam--Part 2 of 2
(This is not the Final Exam)
The Setup:
Your job in this part is to write a complete program to do the following:
-
The program prompts the user to enter a long word
-
The program then prints out all the letters of that word, one letter per
line, with the consonants all the way to the left, but the vowels indented
one tab space.
-
When the user enters "done," the program should end, without printing out
the letters of the word "done."
-
Instead, the program should print out "Goodbye!"
Here is a sample program / user interaction session:
Enter
a (long) word: Suggestion
S
u
g
g
e
s
t
i
o
n
Enter a (long) word:
facetious
f
a
c
e
t
i
o
u
s
Enter a (long) word:
done
Goodbye! |
What You Should Do
-
Create the program and save the program as "tabvowel.c"
What you should turn
in:
-
Test your program to make sure it is working.
-
Note: Your program should work on short words as well as long words
-
When your program is working, email the program to me. To do this,
type
-
mail hochberg@cs.ecu.edu < tabvowel.c
-
NOTE:
It seems that mail is working only from the computers near the wall (the
same ones from which you have to print). So make sure you use one
of those computers when you issue the "mail"
command above!
-
Note: I will send an email back to your csci account to let you know
I received your submissions. If you don't get that within 24 hours,
please call me. Also, feel free to call my office to see if I received
your program (328-0126)