: .
Turbo Delphi - . , .. , 256. :
- string [], , , :
- - shortstring.
, . , , .
=, <, >, <=, >=, <>, . , .
, + - . .
Turbo Delphi ( 6):
6
Concat (s1,s2,..sn:string):string | s1,s2,..sn - | |
Copy (s:string; i,k:integer):string | s ; i ; | |
Length (s:string):integer | s- | |
Pos (subs,s:string):integer | , ( , 0) | sub s |
Trim (s:string):string | s | |
TrimLeft (s:string):string | s | |
TrimRight (s:string):string | s | |
UpperCase (s:string):string | ࠠ | s |
LowerCase (s:string):string | ࠠ c | s |
StringReplace(s,s1,s2:string; flag:tReplaceFlags):string | s s1 s2 tReplaceFlags =set of (rfReplaceAll,rfIgnoreCase) | |
Delete(Var s:string; i,k:integer) | s k i | |
Insert (subs:string; Var s:string;i:integer) | , | subs s i |
Str (x:m:n;Var s:string) | x m, n ( ) s | |
Val (s:string; Var v:integer( real); cod:integer) | s v cod ( , 0) |
|
|
17. , . ( ). .
Program Example_17;
{$APPTYPE CONSOLE}
Uses SysUtils;
Var
InStr: shortstring;
count_word: word; //
count_symb: byte; //
PosProb: byte; //
Begin
write (' : ');
readln (InStr);
count_word:= 0;
count_symb:= 0;
InStr:= Trim(InStr); //
Repeat //
PosProb:= Pos(' ',InStr);
Delete(InStr,PosProb,1)
until PosProb=0;
while length (InStr) <> 0 do
begin
PosProb:= Pos (' ',InStr);
case PosProb of
0: begin // ,
count_word:= count_word+1;
count_symb:= count_symb + length (InStr);
break
end
else //
begin
Delete (InStr,1,PosProb);
count_word:= count_word+1;
count_symb:= count_symb + PosProb-1
end;
end; { case }
end; { while }
writeln (' = ',count_word:6);
writeln (' = ',count_symb/count_word:6:0);
writeln (' !');
readln
End.
(.10):
.10. ( 17)
. . . , .
1. . , . , .
2. , , .
3. , .
4. , .
5. , .
6. , , , .
|
|
7. , .
8. , .
9. , , , .
10. - .
11. , , , , , , .
12. , ..
13. , .
14. , .
15. , , , .
16. , . .
17. , , .
18. , , .
19. , , . .
20. , Delphi Win32 Language . .
21. , Delphi Win32 Language .
22. - .
23. , , .
24. , , .
25. - .
9. ( )
: .
, . () ( ), . , , . :
with < > do < >.
, with, ( ) .
18. . : . . .
Program Example_18;
{$APPTYPE CONSOLE}
Uses SysUtils;
Const size = 3;
Type
tS=string[20];
tStud=record //
Fam: tS;
Oc: array[1..2] of byte;
end;
tGrup = array[1..size] of tStud; //
Var Grup: tGrup;
i,j,Search: integer;
Family: tS;
MidlOc: real48;
Begin
writeln (' ',size,' :');
for i:=1 to size do
begin
write (' : ');
|
|
readln (Grup[i].Fam);
write (' 2 : ');
for j:= 1 to 2 do
read (Grup[i].Oc[j]);
readln
end;
writeln;
write(' : ');
readln (Family);
Search:= 0;
for i:=1 to size do
if Family = Grup[i].Fam then
with Grup[i] do
begin
Search:= Search+1;
MidlOc:= (Oc[1] + Oc[2])/2;
writeln (' ':5,Fam, ': = ',MidlOc:4:2)
end;
if Search = 0 then writeln(' !');
readln
End.
(.11).
.11. ( 18)
, : , , , . . : .
. .
1. : , , , . .
2. : , , , , . , .
3. : , , , . , .
4. : , , , . .
5. - : , , , , , . .
6. : , -, , , , . .
7. : , , , , . , , .
8. : , , , . - .
9. : , -, , , . - .
10. : , , , , . , . .
11. : , , , , . .
|
|
12. : , , , , 100 . .
13. : , , , , . .
14. : , -, , , . .
15. : , , , , . , , .
16. : , , , , . c .
17. : , -, -, , . .
18. : , , , , . , .
19. : , , , , . , .
20. -: , -, , , . - , - .
21. : , , -, , , . , -.
22. : , , , , . , .
23. : , , , , . , .
24. : , -, , , . .
25. -: , , , , . .