Встречено 'as', а ожидался идентификатор - PascalABC.NET
Формулировка задачи:
Встречено 'as', а ожидался идентификатор
17 строка
Решение задачи: «Встречено 'as', а ожидался идентификатор»
textual
Листинг программы
program Sme;
uses
crt;
type
reca = record
name: string[10];
resultat: integer;
end;
var
aa: reca;
Xz, Yz: array [1..40] of byte;
us: array [1..11] of reca;
i, k, k2, kk, och: integer;
H, W, PlayE, Play: ShortInt;
X1, Y1, d: byte;
Kno, onk: Char;
SL, Schot: Word;
Ax, Ay, Bx, By, Ex, Ey, es, sa: Byte;
f1: text;
f2: file of integer;
f3: text;
f4: text;
namen: string[10];
resul: string[20];
prav: string;
procedure stolknovenie;
var
i: integer;
begin
for i := 2 to d - 2 do
begin
if (Xz[i] = Xz[i + 2]) and (Yz[i] = Yz[i + 2]) then
es := 0 else es := 1;
sa := sa * es;
end;
for i := 1 to d - 3 do
begin
if (sa <> 0) and (xz[1] = xz[i + 3]) and (yz[1] = yz[i + 3]) then Play := 0;
end;
if (Xz[1] = 3) or (Xz[1] = 57) or (Yz[1] = 3) or (Yz[1] = 22) Then Play := 0;
end;
procedure Ramka(Xr, Yr: Byte; tt: string; c: byte);
var
i: integer;
begin
TextColor(c);
GotoXY(Xr, Yr + 1);
write(tt);
for i := Xr to Xr + 20 do
begin
GotoXY(i, Yr);
write('*');
GotoXY(i, Yr + 2);
write('*');
end;
for i := Yr to Yr + 2 do
begin
GotoXY(Xr, i);
write('*');
GotoXY(Xr + 20, i);
write('*');
end;
end;
procedure Izm(vv: byte);
begin
Ax := Bx; Ay := By;
Bx := Xz[vv]; By := Yz[vv];
Xz[vv] := Ax; Yz[vv] := Ay;
end;
procedure menu2(q, qq, wq, qw: string);
var
X1, Y1: integer;
begin
Clrscr;
TextBackground(0);
TextColor(15);
for X1 := 25 to 55 do
begin
GotoXY(X1, 4);
Write('*');
GotoXY(X1, 22);
Write('*');
end;
for Y1 := 4 to 22 do
begin
GotoXY(25, Y1);
Write('*');
GotoXY(55, Y1);
Write('*');
end;
GotoXY(31, 7);
Write(q);
K2 := 0;
repeat
K2 := k2 + kk;
kk := 0;
if k2 = 0 Then Ramka(30, 10, qq, 128) else
Ramka(30, 10, qq, 15);
if k2 = 1 then Ramka(30, 14, wq, 128) else
Ramka(30, 14, wq, 15);
if K2 = 2 Then Ramka(30, 18, qw, 128) else
Ramka(30, 18, qw, 15);
Kno := ReadKey;
if Kno = #80 then begin if k2 < 2 then kk := 1 else kk := 0; end else
if Kno = #72 then begin if k2 > 0 then kk := -1 else kk := 0; end;
until Kno = chr(13);
end;
procedure Spravka;
var
i, X1, Y1: Integer;
begin
menu2(' СПРАВКА', ' ПРАВИЛА ИГРЫ ', ' РАЗРАБОТЧИК ', ' НАЗАД ');
if k2 = 0 then
begin
clrscr;
assign(f4, 'd:\kkk\pravila.pas');
reset(f4);
i := 3;
while not EOF(f4) do
begin
GotoXY(3, i);
i := i + 2;
readln(f4, prav);
writeln(prav);
end;
readln;
end;
if k2 = 1 then
begin
clrscr;
TextBackground(0);
TextColor(4);
for X1 := 3 to 77 do
begin
GotoXY(x1, 2);
Write('*');
GotoXY(X1, 23);
write('*');
end;
for Y1 := 2 to 23 do
begin
GotoXY(3, Y1);
Write('*');
GotoXY(77, y1);
Write('*');
end;
assign(f4, 'd:\kkk\avtor.pas');
reset(f4);
d := 7;
while not EOF(f4) do
begin
textcolor(10);
readln(f4, prav);
GotoXY(19, d);
Write(prav);
d := d + 2;
for i := 1 to 4 do
Delay(59000);
end;
close(f4);
readln;
end;
if k2 = 2 then
TextBackground(0);
textcolor(15);
end;
procedure Resultat;
var
i, j: integer;
begin
clrscr;
reset(f1);
for i := 1 to 10 do
begin
readln(f1, us[i].name);
end;
close(f1);
reset(f2);
for i := 1 to 10 do
read(f2, us[i].resultat);
close(f2);
gotoXy(25, 12);
if schot > us[10].resultat then
begin
writeln('Ваш результат составил: ', schot);
gotoxy(30, 13);
writeln('Введите ваше имя...');
gotoxy(36, 14);
read(namen);
end
else
begin
GotoXY(23, 13);
writeln('Вы не побили самый худший результат!!! :(');
GotoXY(13, 14);
writeln('Но не огорчайтесь!!! Вы можете просто написать ваше имя!!!)))');
GotoXY(36, 15);
readln(namen);
end;
us[11].name := namen;
us[11].resultat := schot;
for i := 1 to 11 do
for j := 2 to 11 do
begin
if us[j].resultat > us[j - 1].resultat then
begin
aa := us[j - 1];
us[j - 1] := us[j];
us[j] := aa;
end;
end;
rewrite(f1);
for i := 1 to 10 do
begin
write(f1, us[i].name);
writeln(f1, ' ');
end;
close(f1);
rewrite(f2);
for i := 1 to 10 do
write(f2, us[i].resultat);
close(f2);
rewrite(f3);
for i := 1 to 10 do
writeln(f3, i, ': ', us[i].resultat, ' ', us[i].name);
close(f3);
end;
begin
assign(f3, 'd:\kkk\itog.txt');
assign(f1, 'd:\kkk\imena.txt');
assign(f2, 'd:\kkk\rec.dat');
repeat
repeat
Clrscr;
TextBackground(0);
TextColor(15);
for X1 := 25 to 55 do
begin
GotoXY(X1, 4);
Write('*');
GotoXY(X1, 22);
Write('*');
end;
for Y1 := 4 to 22 do
begin
GotoXY(25, Y1);
Write('*');
GotoXY(55, Y1);
Write('*');
end;
K := 0;
repeat
k := k + kk;
kk := 0;
if k = 0 Then Ramka(30, 6, ' ИГРАТЬ ', 128) else
Ramka(30, 6, ' ИГРАТЬ ', 15);
if k = 1 Then Ramka(30, 10, ' РЕКОРДЫ ', 128) else
Ramka(30, 10, ' РЕКОРДЫ ', 15);
if k = 2 then Ramka(30, 14, ' СПРАВКА ', 128) else
Ramka(30, 14, ' СПРАВКА ', 15);
if k = 3 then Ramka(30, 18, ' ВЫХОД ', 128) else
Ramka(30, 18, ' ВЫХОД ', 15);
Kno := ReadKey;
if Kno = #80 then begin if k < 3 then kk := 1 else kk := 0; end else
if Kno = #72 then begin if k > 0 then kk := -1 else kk := 0; end;
until Kno = chr(13);
if k = 1 then
begin
Clrscr;
GotoXy(36, 5);
writeln('РЕКОРДЫ');
reset(f3);
for i := 1 to 10 do
begin
readln(f3, resul);
GotoXY(32, 7 + i);
Write(resul);
end;
close(f3);
Readln;
end;
if k = 2 then
repeat
spravka;
until k2 = 2;
if k = 3 then
exit;
until (k = 3) or (k = 0);
if k = 0 then begin
menu2(' УРОВЕНЬ СЛОЖНОСТИ', ' ГЛИСТ ', ' ЗМЕЯ ', ' АНАКОНДА ');
end;
if K2 = 0 then begin Sl := 40000; och := 25; d := 5 end else if k2 = 1 then begin
Sl := 30000; och := 50; d := 10 end else begin Sl := 20000; och := 100; d := 15 end;
TextBackground(1);
Textcolor(5);
clrscr;
schot := 0; playE := 1;
Xz[1] := 30;
Yz[1] := 13;
for i := 2 to 40 do
begin
Xz[i] := Xz[1];
Yz[i] := Yz[1];
end;
for X1 := 3 to 57 do
begin
GotoXY(x1, 2);
Write('*');
GotoXY(X1, 23);
write('*');
end;
for Y1 := 2 to 23 do
begin
GotoXY(3, Y1);
Write('*');
GotoXY(57, y1);
Write('*');
end;
Play := 1;
GotoXY(60, 4);
write('СЧЕТ: ');
GotoXY(60, 6);
write('Рост змеи: ');
gotoXY(60, 8);
write('Лучшие результаты:');
reset(f3);
for i := 1 to 3 do
begin
readln(f3, resul);
GotoXY(60, 9 + i);
Write(resul);
end;
close(f3);
repeat
if play = 1 then begin
TextColor(4);
Ax := xz[1]; Ay := Yz[1];
Xz[1] := Xz[1] + H; Yz[1] := Yz[1] + W;
Bx := Xz[2]; By := Yz[2];
Xz[2] := Ax; Yz[2] := Ay;
for i := 3 to 40 do
izm(i);
GotoXY(Xz[1], Yz[1]);
write(chr(1));
for i := 2 to d do
begin
GotoXY(Xz[i], Yz[i]);
Write(chr(4));
end;
Delay(SL);
Textcolor(1);
GotoXY(Xz[1], Yz[1]);
write(chr(1));
for i := 2 to 40 do
begin
GotoXY(Xz[i], Yz[i]);
Write(chr(4));
end;
randomize;
if PlayE = 1 then
begin
Ex := Random(54) + 4;
Ey := random(18) + 4;
if (K2 = 0) and (schot <> 0) and ((schot mod 75) = 0) then
d := d + 1;
if (k2 = 0) and (schot <> 0) and ((schot mod 150) = 0) then
Sl := Sl - 500;
if (K2 = 1) and (schot <> 0) and ((schot mod 150) = 0) then
d := d + 1;
if (k2 = 1) and (schot <> 0) and ((schot mod 500) = 0) then
Sl := Sl - 500;
if (K2 = 2) and (schot <> 0) and ((schot mod 500) = 0) then
d := d + 1;
if (k2 = 2) and (schot <> 0) and ((schot mod 1000) = 0) then
Sl := Sl - 500;
PlayE := 0; end;
Textcolor(6);
GotoXY(Ex, Ey);
write(chr(6));
if (Xz[1] = Ex) and (Yz[1] = Ey) then
begin
schot := schot + och;
PlayE := 1;
Textcolor(1);
GotoXy(Ex, Ey);
write(' ');
end;
case Kno of
#72: begin W := -1; H := 0; end;
#80: begin W := 1; H := 0; end;
#77: begin W := 0; H := 1; end;
#75: begin W := 0; h := -1; end;
end;
if Keypressed = true then begin onk := readkey;Kno := Readkey; end;
end;
GotoXY(66, 4);
write(Schot);
GotoXY(70, 6);
write(d);
sa := 10;
stolknovenie;
until Play = 0;
if play = 0 then begin
TextBackground(0);
Textcolor(15);
clrscr;
GotoXY(6, 8);
write(' ***** ***** * * ******* ***** ** ** ******* ****** ');
GotoXY(6, 9);
write('******* ******* ** ** ******* ******* ** ** ******* *******');
GotoXY(6, 10);
write('** ** ** *** *** ** ** ** ** ** ** ** **');
GotoXY(6, 11);
write('** ** ** **** **** ** ** ** ** ** ** ** **');
GotoXY(6, 12);
write('** ** ** ** *** ** **** ** ** ** ** **** ** **');
GotoXY(6, 13);
write('** ** ******* ** * ** **** ** ** ** ** **** ****** ');
GotoXY(6, 14);
write('** *** ******* ** ** ** ** ** ** ** ** **** ');
GotoXY(6, 15);
write('** ** ** ** ** ** ** ** ** ** ** ** ** ** ');
GotoXY(6, 16);
write('******* ** ** ** ** ******* ******* *** ******* ** ** ');
GotoXY(6, 17);
write(' ***** ** ** ** ** ******* ***** * ******* ** **');
GotoXY(25, 23);
Write('Для продолжения нажмите ENTER');
repeat
kno := readkey;
until Kno = chr(13);
end;
resultat;
H := 0; w := 0; k := 0; kk := 0;
until k = 3; end.