파스칼 코드에 문제가 있습니다. 몇 가지 오류가 있으며 어디서 모르는 지요.구문 오류, ';' 예상했지만 'until'이 발견되었습니다.
program GTA6;
uses
Crt;
var
obraz, x, mampistoli, mamnuz: Integer;
begin
clrscr;
randomize;
obraz := 1;
repeat
clrscr;
if obraz = 1 then
begin
writeln('Je 9:00 rano. Probudis se ve svem byte. Nekdo ti zvoni na dvere. Pujdes otevrit(2) nebo budes zvonek ignorovat(3)?');
readln(obraz);
if (obraz <> 2) and (obraz <> 3) then
obraz := 1;
end
else
if obraz = 2 then
begin
writeln('Otevres dvere a jsou tam dva dvoumetrovy plesaty chlapi s pistolema v ruce. Prej dluzis jejich sefoj 200 000 Kc a chce je vratit do 19:00 jinak te prijdou zabit.');
writeln(' Sahnout po pistoli(4), nedelat nic (5)');
readln(obraz);
if (obraz <> 2) and (obraz <> 3) and (obraz <> 4) and (obraz<> 5) then
obraz := 2;
end
else
if obraz = 5 then
begin
if mampistoli <> 1 then
begin
writeln('Odesli. Ty zjistis, ze nemas 200 000.');
writeln('vzit si pistoli(1), nebo si vzit nuz(2)');
readln(x);
if x = 1 then
mampistoli := 1;
if x = 2 then
mamnuz := 1;
end;
writeln('Takhle narychlo tolik penez nesezenes...budes muset udelat banku, nebo tak neco.');
writeln('Vyloupit banku (6), trafiku (7), vykr st auto (8)');
readln(obraz);
if (obraz <> 6) and (obraz <> 7) and (obraz <> 8) then
obraz := 5;
end
else
if obraz = 6 then
begin
if mampistoli = 1 then
begin
writeln('Rozhodl jsi se vyloupit banku s pistoli.');
writeln('Hlidac videl tvoji zbran a vystrelil po tobe!');
x := random(100);
if x < 50 then
writeln('Trefil te primo do hlavy!');
writeln('Zemrel jsi!');
obraz := 0;
end;
until obraz = 0;
writeln('KONEC HRY');
if x > 50 then
writeln('Netrefil se!');
readln;
end.
어디에 문제가 있습니까?
다른 사람에게 살펴볼 때 코드 서식을 지정하십시오. 게시물을 편집하여 모든 공백을 제거하고 들여 쓰기 쉽게 읽을 수 있습니다. –
'case' 문을 사용하는 법을 배우십시오. 그것은 당신의 스파게티 코드를 단순화합니다. – TLama