14. , .
opy t. = , , . length.
:
program bukva;
var
t,a: string;
x: char; i,k: integer;
begin
write( );
readln(t);
writeln( );
readln(x);
k:= 0;
for i:= 1 to length (t) do
begin
a:= copy (t, i, 1);
if a = x then k:= k + 1;
end;
write ( ,x, , k, .)
end.
Copy . :
for i:= 1 to length (t) do
if t(i) = x then k:= k + 1;
15. , . .
. , .
:
program bukslova;
var
t,a: string;
x: char; i,k: integer;
begin
write( );
readln(t);
writeln( );
readln(x);
i:= 1; k:= 0;
while i <> 0 do
begin
a:= copy (t, 1, 1);
if a = x then k:= k + 1;
i:= pos( ,t);
t:= copy (t, i + 1, length(t)i);
end;
write ( ,x, = , k)
end.
a ; i ; t . , t .
16. .
:
program slovo;
var
t,a,b,c,s: string;
i: integer;
begin
write( );
readln(t);
writeln( , );
readln(a);
writeln( , );
readln(b);
t:= t + ;
writeln ( ); writeln (t);
i:= 1; s:= ;
while i <> 0 do
begin
i:= pos( ,t);
c:= copy (t, 1, i 1);
if c = a then s:= s + b + else s:= s + c + ;
t:= copy (t, i + 1, length(t) i)
end;
writeln ( ); writeln (s)
end.
Copy. : , b, . , . (t:= t + ;).
17. , .
12 . , . . 1 12, 1 31. , .
|
|
:
program zodiak;
uses crt;
label 1;
const
dt: array[1..12] of real = (01.19,2.18,3.20,4.19,5.20,
6.21,7.22,8.22,9.22,10.22,11.22,12.21);
zod: array[1..12] of string[10] = (,,,
,,,,,
,,,);
var
s:string[10];
x,i:integer;r,y:real;sem:char;
begin
repeat
1: clrscr;
write( , : 01.22 12.28);
readln(r);
{ }
x:= trunc(r);
if (x < 1) or (x > 12) then begin
write( );
delay(1000); goto 1
end;
{ }
y:= frac(r);
if (y < 0.01) or (y > 0.31) then begin
write( );
delay(1000); goto 1
end;
{ }
s:= zod[12];
for i:= 1 to 11 do
if(r > dt[i]) and (r <= dt[i+1]) then s:= zod[i];
{ }
writeln( , r:5:2);
writeln( ,s);
writeln( , Y);
sem:= readkey;
until upcase(sem) = Y
end.
(repeat... until) , Y y. y Upcase . delay(t) crt t .
, , , . . . - , . . () . , . .
. , . , .
.
:
) ;
) . . ;
) .
. : ; n ; fio , , ; mark .
() . :
|
|
.
,
B.n
B.fio
B.mark
, , .
:
< > = record < > end
< > ; record, end (, ); < > , . , . () ().
:
type
list = record
n: integer;
fio: array [1..20] of char;
mark: array [1..3] of integer
end;
var B: list;
:
var B: record
n: integer;
fio: array [1..20] of char;
mark: array [1..3] of integer
end;
, . , . , . , , . , , :
n B 2:
B.n:= 2;
:
s:= B.mark [1] + B.mark [2] + B.mark [3];
:
read (B.n).
, , . .
birthday, day, month year; b birthday; c , .
type
birthday = record
day,month: byte;
year: word
end;
var a,b: birthday;
c: record
name: string;
bd: birthday
end;
a:= b; a.day:= 27; b.year:= 1939; : .bd.year, c.bd.day, c.bd.month.
. 14.
. 14
(. 15):
. 15