Back to DFS's Pascal Page


Pascal Madlib Problem II

Using Procedures & Global Variables

Herman's maître d' says, "Me and the boys were trying to guess how you spell your name." Obviously, he has some grammar and sequencing problems. To help him out, you have two jobs to do.

Be creative!!! Your fellow students will have an opportunity to do your madlib during the next class.

program Madlib(input, output);
 var
  uname, noun, place, number, liquid: string;

 procedure greeting;
 begin
  write('Hello, what is your name? ');
  readln(uname);
  writeln;
  writeln('I hope you enjoy madlibs, ', uname:0, '.')
 end; {procedure greeting}

 procedure choices;
 begin
  writeln('Please choose your words.');
  writeln('Try to pick funny words, ', uname:0, '.');
  writeln;
  write('Type a noun which is a thing. ');
  readln(noun);
  write('Type your least favorite city or country. ');
  readln(place);
  write('Type a number. ');
  readln(number);
  write('Type a liquid. ');
  readln(liquid)
 end; {procedure choices}

 procedure printlaw;
 begin
  writeln;
  writeln('It will be unlawful to own a ', noun:0);
  writeln('or to carry a concealed ', noun:0);
  writeln('without a ', noun:0, ' license.');
  writeln('The penalty for ', noun:0, '-carrying');
  writeln('will be thirty days in ', place:0);
  writeln('or a fine of ', number:0, ' dollars.');
  writeln('The penalty is double if the person');
  writeln('is arrested while under the influence');
  writeln('of ', liquid:0, '.')
 end; {procedure printlaw}

 procedure thanks;
 begin
  writeln;
  write('I hope you liked your new law, ');
  writeln(uname:0, '.');
  writeln;
  writeln('Thank you for using my madlib.')
 end; {procedure thanks}

begin {main}
 greeting;
 choices;
 printlaw;
 thanks;
 readln
end.

© 1997-99 DFStermole
Created 16 Dec 97
HTMLified 31 Dec 99