Код
program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
t:text;
Function COUNT(var t:text;buk:char):byte;
var
str:string;
Kol:byte;
begin
reset(t);
Kol:=0;
if buk='d' then
While not EOF(t) do
begin
Read(t,str);
if str[1]='d' then
Kol:=Kol+1;
Readln(t);
end;
if buk='z' then
While not EOF(t) do
begin
Read(t,str);
if str[Length(str)]='z' then
Kol:=Kol+1;
Readln(t);
end;
COUNT:=Kol;
end;
begin
Assign(t,'file.txt');
Writeln('Nachinaetsa na d :',COUNT(t,'d'));
Writeln('Okanchivaetsa na z :',COUNT(t,'z'));
Close(t);
Readln;
end.
{$APPTYPE CONSOLE}
uses
SysUtils;
var
t:text;
Function COUNT(var t:text;buk:char):byte;
var
str:string;
Kol:byte;
begin
reset(t);
Kol:=0;
if buk='d' then
While not EOF(t) do
begin
Read(t,str);
if str[1]='d' then
Kol:=Kol+1;
Readln(t);
end;
if buk='z' then
While not EOF(t) do
begin
Read(t,str);
if str[Length(str)]='z' then
Kol:=Kol+1;
Readln(t);
end;
COUNT:=Kol;
end;
begin
Assign(t,'file.txt');
Writeln('Nachinaetsa na d :',COUNT(t,'d'));
Writeln('Okanchivaetsa na z :',COUNT(t,'z'));
Close(t);
Readln;
end.