uses CRT;
CONST
TheFileName = '183682.txt';
nums: Set of Char = ['0' .. '5'];
chars: Set of Char = ['A'..'z', 'А' ..'п', 'р' .. 'я'];
VAR
f: Text;
S, name: String;
i, count, numCount: Integer;
A_student: Boolean; {отличник}
BEGIN
Assign(f, TheFileName);
{$I-} Reset(f); {$I+}
if IOResult <> 0 then begin
WriteLn('Не могу открыть файл ', TheFileName,
'. Работа программы завершается');
WriteLn('Нажмите любую клавишу');
ReadKey; Halt(1)
end;
Count := 0;
While NOT EOF(f) do begin
ReadLn(f, S);
if S <> '' then begin
name := '';
i:=1;
while (NOT (S[i] in chars)) and (i <= length(S)) do inc(i);
while (S[i] in chars) and (i <= length(S)) do begin
name := name + S[i];
inc(i);
end;
if name = '' then Continue; {Фамилии нет}
A_student := TRUE;
Write(name,' ');
while (i <= length(S)) do begin
while (NOT (S[i] in nums)) and (i <= length(S)) do inc(i);
A_student := A_student and (S[i] = '5');
inc(i);
if NOT A_student then Continue;
end;
if A_student then begin
WriteLn('Отличник');
inc(count)
end
else WriteLn('Так себе');
end;
end;
if Count = 0 then
Writeln('На отлично не сдал ни один абитуриент')
else
WriteLn('На отлично сдало абитуриентов: ', count);
WriteLn('Нажмите любую клавишу');
ReadKey
END.
uses CRT;
CONST
TheFileName = '183682.txt';
nums: Set of Char = ['0' .. '5'];
chars: Set of Char = ['A'..'z', 'А' ..'п', 'р' .. 'я'];
VAR
f: Text;
S, name: String;
i, count, numCount: Integer;
A_student: Boolean; {отличник}
BEGIN
Assign(f, TheFileName);
{$I-} Reset(f); {$I+}
if IOResult <> 0 then begin
WriteLn('Не могу открыть файл ', TheFileName,
'. Работа программы завершается');
WriteLn('Нажмите любую клавишу');
ReadKey; Halt(1)
end;
Count := 0;
While NOT EOF(f) do begin
ReadLn(f, S);
if S <> '' then begin
name := '';
i:=1;
while (NOT (S[i] in chars)) and (i <= length(S)) do inc(i);
while (S[i] in chars) and (i <= length(S)) do begin
name := name + S[i];
inc(i);
end;
if name = '' then Continue; {Фамилии нет}
A_student := TRUE;
Write(name,' ');
while (i <= length(S)) do begin
while (NOT (S[i] in nums)) and (i <= length(S)) do inc(i);
A_student := A_student and (S[i] = '5');
inc(i);
if NOT A_student then Continue;
end;
if A_student then begin
WriteLn('Отличник');
inc(count)
end
else WriteLn('Так себе');
end;
end;
if Count = 0 then
Writeln('На отлично не сдал ни один абитуриент')
else
WriteLn('На отлично сдало абитуриентов: ', count);
WriteLn('Нажмите любую клавишу');
ReadKey
END.
Если Вы уже зарегистрированы на Портале - войдите в систему, если Вы еще не регистрировались - пройдите простую процедуру регистрации.