program ghost;

uses crt;

var question: String[256]; firstword: String[10]; menu: Integer;

procedure insertQuestion;

var i: Integer; c: char;

begin

Writeln ("Ask me a question...");

Readln(question);

c := ""; 

i := 1; 

while (c<>" ") or (i<>11) do 

begin

firstword[i]:=question[i];

i := i+1;

end;

end;

procedure createAnswer;

var i: Integer; rand: Integer;

begin

rand := random(5)+1;

CASE firstword OF: 

'Why', 'why':

begin

if rand=1 then Writeln("Because gods said so!");

if rand=2 then Writeln("I think it's because of your life.");

if rand=3 then Writeln("I cannot say it, it's secret to the mortals.");

if rand=4 then Writeln("I don't know.");

if rand=5 then Writeln("Well, maybe you should aks yourself that question.");

end;

'What', 'what':

if rand=1 then Writeln("I think that what you would like to.");

if rand=2 then Writeln("Maybe you are scared?");

if rand=3 then Writeln("Ask someone else, I cannot tell.");

if rand=4 then Writeln("I am only a ghostly spirit...");

if rand=5 then Writeln("I am sure that you already know the answer.");

begin

end;

'Where', 'where':

if rand=1 then Writeln("Where the rainbow touches the surface of earth.");

if rand=2 then Writeln("Somewhere far far away from you.");

if rand=3 then Writeln("I daresay that you don't know where.");

if rand=4 then Writeln("The place that is really special for you.");

if rand=5 then Writeln("Home is where the heart is.");

begin

end;

'Who', 'who':

if rand=1 then Writeln("Someone you loved.");

if rand=2 then Writeln("Really nasty human being.");

if rand=3 then Writeln("The person who is really valuable but lonely.");

if rand=4 then Writeln("What do you think? You should know.");

if rand=5 then Writeln("The only one, special one.");

begin

end;

'How', 'how':

if rand=1 then Writeln("I don't know!");

if rand=2 then Writeln("In a very nasty way.");

if rand=3 then Writeln("In a very beautiful way.");

if rand=4 then Writeln("You shouldn't be asking me this.");

if rand=5 then Writeln("You already know how, you just don't want to admit it...");

begin

end;

'Is', 'Are', 'is', 'are':

if rand=1 then Writeln("Yes.");

if rand=2 then Writeln("No.");

if rand=3 then Writeln("I cannot tell you, you are not allowed to know.");

if rand=4 then Writeln("I don't have that knowledge.");

if rand=5 then Writeln("I think so.");

begin

end;

'Am', 'am':

if rand=1 then Writeln("Yes, you are.");

if rand=2 then Writeln("No, you are not.");

if rand=3 then Writeln("You know who you are, so you know the answer.");

if rand=4 then Writeln("I am afraid that you couldn't be.");

if rand=5 then Writeln("You might be, but I am not sure.");

begin

end;

else

begin

if rand=1 then Writeln("I can't understand you.");

if rand=2 then Writeln("Please, ask me a question.");

if rand=3 then Writeln("Oh gods, how long will I stay with this mortal?");

if rand=4 then Writeln("I don't have much time.");

if rand=5 then Writeln("Words, words, words...");

end;

END;

end;

BEGIN

menu := 10;

Writeln("****************************************");

Writeln("*****************GHOST******************");

Writeln("****************************************");

while menu <>0 do

begin

insertQuestion;

createAnswer;

end;

Writeln("My time has gone, see you in the other life, mortal...");

readln;

END.