Sākumlapa › Forumi › Citas tēmas › Off-topic › Pascal uzdevums
program teksta_analize_2;
var
rst: word;
t, ovpb: string;
ast: longint;
begin
writeln(‘Ievadiet vienu teikumu!’);
readln(t);
rst:=length(t);
writeln(‘Rakstzimju skaits teikuma ir: ‘,rst);
ovpb:=t[7];
writeln(‘Otrais vards sakas ar burtu: ‘,ovpb);
writeln(‘Atstarpju skaits teikuma ir: ‘,ast);
writeln(‘Piespiediet taustinu Enter!’);
readln;
end.
[spoil]
program teksta_analize_2;
const
MYSPACE = ‘ ‘;
var
gar, ast, e: word;
t: string;
ovpb: char;
begin
writeln(’Ievadiet vienu teikumu:’);
readln(t);
gar := length(t);
if gar = 0 then
begin
writeln(’Es teicu “vienu teikumu”!’);
halt(1);
end;
e := pos(MYSPACE, t);
if e
begin
ast := ast + 1;
delete(t, 1, e);
e := pos(MYSPACE, t);
end;
writeln(’Rakstzimju skaits teikuma ir: ‘, gar – ast);
writeln(’Atstarpju skaits teikuma ir: ‘, ast);
if (ast > 0) and (ovpb in [’A’..’Z’, ‘a’..’z’]) then
writeln(’Otrais vards sakas ar burtu: ‘, ovpb, ‘ (ASCII = ‘, ord(ovpb) , ‘)’)
else
writeln(’Vispar tas nav riktigs teikums…e, Zans Klods van Sekspirs atradies.’);
writeln(’Piespiediet taustinu Enter! Un ta riktigi, lai jamais jut.’);
readln;
end.
[/spoil]
Edit: Zaļibalti IT portāls bļek… nesa3.14stu kodu skat.
Preses relīzes