* "F" (file) specs define files and other i/o devices
FARMstF1 UF E K Disk Rename(ARMST:RARMST)
* "D" specs are used to define variables and parameters
* The "prototype" for the program is in a separate file
* allowing other programs to call it
/copy cust_pr
* The "procedure interface" describes the *ENTRY parameters
D getCustInf PI
D pCusNo 6p 0 const
D pName 30a
D pAddr1 30a
D pAddr2 30a
D pCity 25a
D pState 2a
D pZip 10a
/free
// The "chain" command is used for random access of a keyed file
chain pCusNo ARMstF1;
// If a record is found, move fields from the file into parameters
if %found;
pName = ARNm01;
pAddr1 = ARAd01;
pAddr2 = ARAd02;
pCity = ARCy01;
pState = ARSt01;
pZip = ARZp15;
endif;
// RPG makes use of switches. One switch "LR" originally stood for "last record"
//LR actually flags the program and its dataspace as removable from memory.
*InLR = *On;
/end-free
Объяснение:
Объяснение:
Задание 1
program bukva;
const R=[' ','.',',',';',':','?','!','-']; // разделители
var
s,bukv:string;
i,kol,len:integer;
procedure UpCaseRus(var s:string);
{русские в верхний регистр}
var i:integer;
begin
for i:=1 to length(s) do
if s[i] in ['а'..'п'] then s[i]:=chr(ord(s[i])-32)
else if s[i] in ['р'..'я'] then s[i]:=chr(ord(s[i])-80)
else if s[i]='ё' then s[i]:='Ё';
end;
begin
readln(s);
readln(bukv);
UpCaseRus(s);
UpCaseRus(bukv);
For i:=length(s) downto 2 do
if ((s[i] in R) and (s[i-1] in R)) then delete(s,i,1);
len:=length(s);
kol:=0;
for i:=len downto 1 do
begin
if s[i] in R then
if s[i+1]=bukv then kol:=kol+1;
end;
if s[1]=bukv then kol:=kol+1;
writeln('Слов на букву '+bukv+' ',kol);
readln;
end.
Задание 2
const r=[' ','.',',',';',':','?','!','-'];
var
s:string;
i,kol,d:integer;
begin
readln(s);
len:=length(s);
kol:=0; d:=0;
For i:=length(s) downto 2 do
if ((s[i] in r) and (s[i-1] in r)) then delete(s,i,1);
for i:=1 to length(s) do
begin
if s[i] in r then kol:=kol+1
else if (s[i] in ['0'..'9']) then d:=d+1;
end;
writeln('Слов всего ',kol+1);
writeln('Цифр в тексте ',d);
readln;
end.
2. 7 Кбайт = 7*1024 байт.
Если для кодирования русских символов используется 8-битная кодировка (8 бит = 1 байт), то количество символов = 7*1024 / 1 = 7168.
Если для кодирования русских символов используется 16-битная кодировка (16 бит = 2 байта), то количество символов = 7*1024 / 2 = 3584.