const n = 50; var i:byte; B:array[1..n] of word; procedure proc(A:array of word); begin for i:=1 to n do if((129 <= A[i]) and (A[i] <= 160)) or ((161 <= A[i]) and (A[i] <=175)) or ((225 <= A[i]) and (A[i] <= 242)) then Writeln('index = ',i+1,'; bukva - ''',char(A[i]),,' A[i] = ',A[i]); end;
Begin writeln; for i:=1 to n do B[i] := random(300); for i:=1 to n do Begin write(' ',i,' = ',B[i]); if (i mod 5 = 0) then writeln; end; writeln; writeln; proc(B); readln;
type adrcel=^Element; Element=record info:integer; next:adrcel; end; var start,last,new_el:adrcel; i:integer;
procedure del2(var start:adrcel);
var
p:adrcel;
begin
p:=start^.next;
if p<>nil then start^.next:=p^.next
end;
begin start:=nil; last:=nil; new_el:=nil; repeat new(new_el); write('info='); readln(new_el^.info);
new_el^.next:=nil; if start=nil then start:=new_el; else begin
last:=start;
while last^.next<>nil do last:=last^.next; last^.next:=new_el; end; write('Продолжить? (1-Да/0-Нет):'); readln(i); until i=0; writeln('Удалим 2-й элемент');
del2(start);
new_el:=start; while new_el<>nil do begin write(new_el^.info:4); new_el:=new_el^.next; end; readln; end.
пример программы для паскаль
Program a;
const n = 50;
var
i:byte;
B:array[1..n] of word;
procedure proc(A:array of word);
begin
for i:=1 to n do
if((129 <= A[i]) and (A[i] <= 160)) or
((161 <= A[i]) and (A[i] <=175)) or
((225 <= A[i]) and (A[i] <= 242)) then
Writeln('index = ',i+1,'; bukva - ''',char(A[i]),,' A[i] = ',A[i]);
end;
Begin
writeln;
for i:=1 to n do
B[i] := random(300);
for i:=1 to n do Begin
write(' ',i,' = ',B[i]);
if (i mod 5 = 0) then writeln;
end;
writeln;
writeln;
proc(B);
readln;
end.
type
adrcel=^Element;
Element=record
info:integer;
next:adrcel;
end;
var
start,last,new_el:adrcel;
i:integer;
procedure del2(var start:adrcel);
var
p:adrcel;
begin
p:=start^.next;
if p<>nil then start^.next:=p^.next
end;
begin
start:=nil;
last:=nil;
new_el:=nil;
repeat
new(new_el);
write('info=');
readln(new_el^.info);
new_el^.next:=nil;
if start=nil then
start:=new_el;
else
begin
last:=start;
while last^.next<>nil do last:=last^.next;
last^.next:=new_el;
end;
write('Продолжить? (1-Да/0-Нет):');
readln(i);
until i=0;
writeln('Удалим 2-й элемент');
del2(start);
new_el:=start;
while new_el<>nil do
begin
write(new_el^.info:4);
new_el:=new_el^.next;
end;
readln;
end.