MADLIBS! Let's build a system loads a madlib from a file and gets the appropriate input from the user.
The program should run with a command line argument which indicates which file to load. For example:
./madlibExecutable madlib1.txt
The input file should contain the text of the madlib on separate lines. The user input is indicated by a single capital letter on a separate line:
A – Adjective
N – Noun
V – Verb
There are two example files provided so you can understand the input format.
Input File 1:
It was a
A
, cold November day. I woke up to the
A
smell of
N
roasting in the
N
downstairs. I went down the stairs to see if I could help
V
the dinner. My mom said, "See if your dad needs a fresh
N
." So I carried a tray of glasses full of
N
into the living room. When I got there I couldn't believe my
N
! There were
N
all over the
N
!
Input File 2:
Today, every student has a computer
A
enough to fit into their
N
. They can solve any math problem by simply pushing the computer's
A
buttons. Computers can add, subtract, multiply, and
V
better than a human. They have a
A
screen that shows all kinds of
N
and
A
figures.
Sample Output:
cutable madlib1.txt
Please enter an adjective: cold
Please enter an adjective: dark
Please enter a noun: chicken
Please enter a noun: key
Please enter a verb: stab
Please enter a noun: show
Please enter a noun: skunk
Please enter a noun: pile of laundry
Please enter a noun: shark
Please enter a noun: chair
It was a cold , cold November day. I woke up to the dark smell of chicken roasting in the key downstairs. I went down the stairs to see if I could help stab the dinner. My mom said, "See if your dad needs a fresh show." So I carried a tray of glasses full of skunk into the living room. When I got there I couldn't believe my pile of laundry ! There were shark all over the chair !