program Variant_1 APPTYPE CONSOLE uses SysUtils const NMax 10 min -50

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
program Variant_1;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
NMax = 10;
min = -50;
max = 50;
function CharToOem(lpszSrc: PChar; lpszDst: PChar): BOOLean; stdcall; external 'user32.dll' name 'CharToOemA';
function rus(s: string): string;
begin
SetLength(result, length(s));
CharToOem(PChar(S), PChar(result));
end;
function readint: integer;
var tmp: string;
err: integer;
begin
repeat
readln(tmp);
val(tmp, result, err);
until err = 0;
end;
var
arr: array[1..NMax] of integer;
i, n,m: integer;
f: boolean = false;
begin
randomize;
Write(rus('Введите размер массива'),' 0<N<=',NMax,': ');
repeat
n:=readint;
until (0<n)and(n<=10);
for i := 1 to n do begin
arr[i] := random(max - min) + min;
writeln('arr[', i, ']=', arr[i]);
end;
Write(rus('Введите значение искомого элемента: ')); m := readint;
for i := 1 to n do if arr[i] = m then begin
writeln('arr[', i, ']=', arr[i]);
f := true;
end;
if not f then writeln(rus('Элемент не найден'));
readln;
end.