program Adventure;
uses Crt;
var
guess : integer ;
begin
TextColor(White);
TextBackground(Green);
writeln('Adventure');
writeln('You are an adventurer. You are having an adventure in the forrest but you get lost in the way. You need to answer questions to escape from the forrest.');
writeln('The game will start now.');
writeln('Question1: You are hungry now. You find a mushroom. Will you eat it?');
writeln('Press ',1,'=yes, ',2,'=no.');
readln(guess);
if guess = 1 then
begin
{condition 1}
writeln('It is a toxic mushroom. You died.');
writeln('This is the end of the game.');
readln;
end
else if guess = 2 then
begin
{condition 2}
writeln('You do not eat the mushroom but you catch some fishes in the river.');
writeln('You are full now and have energy to find the way to escape frome forest.');
writeln('Question2:You see a bear and it keeps follow you. Will you climb up to a tree?');
writeln('Press ',1,'=yes, ',2,'=no.');
readln(guess);
if guess = 2 then
begin
{condition 1}
writeln('You are killed by the bear.');
writeln('This is the end of the game.');
readln;
end
else if guess = 1 then
begin
{condition 2}
writeln('You escape from the bear.');
writeln('Question3:Will you get in the cave?');
writeln('Press ',1,'=yes, ',2,'=no.');
readln(guess);
readln;
if guess = 1 then
begin
{condition 1}
writeln('You are killed by the lion which live in the cave');
writeln('This is the end of the game.');
readln;
end
else if guess = 2 then
begin
{condition 2}
writeln('Although you get wet, but you find the way to escape from the forrest finally.');
writeln('Congratulations!');
writeln('This is the end of the game.');
readln;
end;
end.
这是一个关于冒险的迷你游戏。此外,该计划无法显示预期的答案。抛出的错误是:致命:语法错误,;预期但是。找到。我想也许我的逻辑错了。谢谢你;)
答案 0 :(得分:1)
你错过了两个'结束;'声明。我重新格式化以显示问题(和解决方案)。
program Adventure;
uses Crt;
var
guess : integer ;
begin
TextColor(White);
TextBackground(Green);
writeln('Adventure');
writeln('You are an adventurer. You are having an adventure in the forrest but you get lost in the way. You need to answer questions to escape from the forrest.');
writeln('The game will start now.');
writeln('Question1: You are hungry now. You find a mushroom. Will you eat it?');
writeln('Press ',1,'=yes, ',2,'=no.');
readln(guess);
if guess = 1 then
begin
{condition 1}
writeln('It is a toxic mushroom. You died.');
writeln('This is the end of the game.');
readln;
end
else if guess = 2 then
begin
{condition 2}
writeln('You do not eat the mushroom but you catch some fishes in the river.');
writeln('You are full now and have energy to find the way to escape frome forest.');
writeln('Question2:You see a bear and it keeps follow you. Will you climb up to a tree?');
writeln('Press ',1,'=yes, ',2,'=no.');
readln(guess);
if guess = 2 then
begin
{condition 1}
writeln('You are killed by the bear.');
writeln('This is the end of the game.');
readln;
end
else if guess = 1 then
begin
{condition 2}
writeln('You escape from the bear.');
writeln('Question3:Will you get in the cave?');
writeln('Press ',1,'=yes, ',2,'=no.');
readln(guess);
readln;
if guess = 1 then
begin
{condition 1}
writeln('You are killed by the lion which live in the cave');
writeln('This is the end of the game.');
readln;
end
else if guess = 2 then
begin
{condition 2}
writeln('Although you get wet, but you find the way to escape from the forrest finally.');
writeln('Congratulations!');
writeln('This is the end of the game.');
readln;
end;
end;
end;
end.