(...end;
read(s);
end. ): error 85 ";" expected. Понятно что пропустил знак точка с запятой, но вопрос: какая в конце программы точка с запятой??? Там должен быть and. а он говорит надо ; Ни чего не могу понять... Вот код программы:
Код: Выделить всё
program Coding_and_decoding_of_the_text_information_by_method_Gronsfelds;
uses crt,dos;
{Procedures and function}
function getnum(c: char): integer;
var
n: integer;
{Show title}
procedure title;
begin
window(1,1,1,80);
textbackground(2);
clrscr;
gotoxy(27,1);
textbackground(5);
textcolor(133); write('CODETIMEG');
end;
{Main change}
const
N1 = 5; { The maximum quantity of lines in a file }
N2 = 3; { Quantity of alphabets }
var
f,f1: text;
s,ne,s1: string;
i,j,k,l,m: integer;
ce: integer; { The counter of a position in a line of a code }
w : array [1..N1] of string; { Lines }
w1 : array [1..N1] of string; { Lines }
abc : array [1..N2] of string; { Alphabets }
sign : string;
label menugame,coding,decoding,help;
{Main part}
begin
clrscr;
{Menu programm}
menugame:
while 1>0 do
begin
title;
gotoxy(30,18);
textcolor(1);
write('Press C for coding');
gotoxy(30,20);
textcolor(1);
write('Press D for decoding');
gotoxy(30,22);
textcolor(1);
write('Press H for help');
gotoxy(30,24);
textcolor(1);
write('Press E for exit');
case readkey of
#99 : goto coding;
#100 : goto decoding;
#104 : goto help;
#101 : exit;
end;
end;
{Coding}
coding:
begin
case c of
'0': n := 0;
'1': n := 1;
'2': n := 2;
'3': n := 3;
'4': n := 4;
'5': n := 5;
'6': n := 6;
'7': n := 7;
'8': n := 8;
'9': n := 9;
else
n := -1;
end;
getnum := n;
end;
begin
abc[1] := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
abc[2] := 'abcdefghijklmnopqrstuvwxyz';
abc[3] := '0123456789';
writeln(' *** An encryption method Gronsfeld ***');
write('Enter a full way to a file from which it is readable: '); readln(s);
write('Enter a full way to a file in which we write: '); readln(s1);
write('Enter a digital key (4 figures or less): '); readln(n);
assign(f,s); assign(f1,s1);
reset(f); rewrite(f1);
i := 1;
{ Reads a file }
while not EOF(f) and (i<=N1) do begin
readln(f,w[i]); w1[i]:=w[i];
inc(i);
end;
{ We code }
{ 1-st cycle - in the lines from a file }
{ 2-nd cycle - on elements in line from a file }
{ 3-rd cycle - under alphabets }
{ 4-th cycle - on elements of the alphabet }
ce := 1;
for i := 1 to N1 do if ord(w[i][0])<>0 then
for j := 1 to (ord(w[i][0])+1) do
for k := 1 to N2 do
for l := 1 to (ord(abc[k][0])+1) do begin
if abc[k][l]=w[i][j] then begin
m := l+getnum(ne[ce]); inc(ce); if ce>ord(ne[0]) then ce := 1;
if m>ord(abc[k][0]) then m := m-ord(abc[k][0]);
w1[i][j] := abc[k][m];
end;
end;
for i:=1 to N1 do begin
writeln(w[i]);
writeln(w1[i]);
end;
for i := 1 to N1 do begin
for j := 1 to ord(w1[i][0]) do write(f1,w1[i][j]);
writeln(f1,s1,'');
end;
begin
title;
gotoxy(30,18);
textcolor(1);
write('Press C for coding');
gotoxy(30,20);
textcolor(1);
write('Press D for decoding');
gotoxy(30,22);
textcolor(1);
write('Press H for help');
gotoxy(30,24);
textcolor(1);
write('Press E for exit');
case readkey of
#99 : goto coding;
#100 : goto decoding;
#104 : goto help;
#101 : exit;
end;
end;
read(s);
end;
{Decoding}
decoding:
begin
case c of
'0': n := 0;
'1': n := 1;
'2': n := 2;
'3': n := 3;
'4': n := 4;
'5': n := 5;
'6': n := 6;
'7': n := 7;
'8': n := 8;
'9': n := 9;
else
n := -1;
end;
getnum := n;
end;
begin
abc[1] := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
abc[2] := 'abcdefghijklmnopqrstuvwxyz';
abc[3] := '0123456789';
writeln(' *** An encryption method Gronsfeld ***');
write('Enter a full way to a file from which it is readable: '); readln(s);
write('Enter a full way to a file in which we write: '); readln(s1);
write('Enter a digital key (4 figures or less): '); readln(n);
assign(f,s); assign(f1,s1);
reset(f); rewrite(f1);
i := 1;
{ Reads a file }
while not EOF(f) and (i<=N1) do begin
readln(f,w[i]); w1[i]:=w[i];
inc(i);
end;
{ We code }
{ 1-st cycle - in the lines from a file }
{ 2-nd cycle - on elements in line from a file }
{ 3-rd cycle - under alphabets }
{ 4-th cycle - on elements of the alphabet }
ce := 1;
for i := 1 to N1 do if ord(w[i][0])<>0 then
for j := 1 to (ord(w[i][0])+1) do
for k := 1 to N2 do
for l := 1 to (ord(abc[k][0])+1) do begin
if abc[k][l]=w[i][j] then begin
m := l-getnum(ne[ce]); inc(ce); if ce>ord(ne[0]) then ce := 1;
if m<1 then m := m+ord(abc[k][0]);
w1[i][j] := abc[k][m];
end;
end;
for i:=1 to N1 do begin
writeln(w[i]);
writeln(w1[i]);
end;
for i := 1 to N1 do begin
for j := 1 to ord(w[i][0]) do write(f1,w1[i][j]);
writeln(f1,s1,'');
end;
begin
gotoxy(30,18);
textcolor(1);
write('Press C for coding');
gotoxy(30,20);
textcolor(1);
write('Press D for decoding');
gotoxy(30,22);
textcolor(1);
write('Press H for help');
gotoxy(30,24);
textcolor(1);
write('Press E for exit');
case readkey of
#99 : goto coding;
#100 : goto decoding;
#104 : goto help;
#101 : exit;
end;
end;
read(s);
end;
{Help}
help:
begin
write('This is help');
end;
begin
gotoxy(30,18);
textcolor(1);
write('Press C for coding');
gotoxy(30,20);
textcolor(1);
write('Press D for decoding');
gotoxy(30,22);
textcolor(1);
write('Press H for help');
gotoxy(30,24);
textcolor(1);
write('Press E for exit');
case readkey of
#99 : goto coding;
#100 : goto decoding;
#104 : goto help;
#101 : exit;
end;
end.