Our Third Programming Assignment
The goal of this assignment is for you to create the "namegame2.c"
program
which is an addition to "namegame.c"
as follows:
The Additions:
The program should ask the user to input a name, and as long as the
user inputs either:
"chuck" or
"Chuck" or
a name without vowels
it should reprompt the user for another name. This should be done
with a while
loop, as we saw in class.
Some Pointers
-
The characters "&&" mean "AND" So the expression "this
&& that", for example, returns true if both this
and that are true.
-
Don't forget to initialize the string variable that holds the user input
before
the while loop, so that the program will enter the while loop at least
once
-
You'll need to put a loop (a lot like the "check for vowels" loop that's
already in the program) inside this while
loop in order to check for vowels there.
-
Note that I added some overall "loop" structure to the program so that
the program will keep asking for another name, until the user enters "done"
as the name. This is what the "do{"
at the top and "}while(...);"
at the bottom are about.
What you should turn
in:
-
First, you need to create a file called "names.txt".
This file should contain just the following names, on nine separate lines,
with nothing else in the file:
Billy
chuck
Cwmlrr
Ansel
Quincy
Chuck
Shrshen
done
Robert
(Please be careful to get the uppercase and lowercase letters right...)
-
You can test your program/file by typing cat
names.txt | a.out
-
When your program is working, type cat
names.txt | a.out | lpr to generate the first printout
that you should hand in.
-
Then type whoami >>
wi ; cat wi namegame2.c | lpr to generate the second
printout that you should hand in.
(Note that if "wi"
does not already exist in your directory, then you should use single ">"
instead of double ">>")