#4 Mircosoft
Tak hotovo. S pomocí nápovědy / díky :věrný člen / a google. Tu je výsledek.
{ you can add units after this },crt;
type index='A'..'z';
indexx='0'..'9';
VAR
a:array [index] of integer;
b:array [indexx] of integer;
TEXT:string;
JJ,II,f:integer;
znak,s:char;
Suma: longint;
begin
(*vlozeni textu*)
writeln (' ','Zadej pozadovany text');
writeln (' ');
textcolor(2);
readln (TEXT);
writeln (' ');
For JJ:=1 to length(TEXT) do
For II:=1to length (TEXT)-1 do
begin
(*serazeni textu*)
IF TEXT [II]>TEXT[II+1]then
begin
znak:=TEXT[II];
text[II]:=text[II+1];
text[II+1]:=znak;
end;
end;
textcolor(3);
(*serazeni mezer*)
For II:=1 to length(text) do
begin
(*vypis textu*)
write(text[II]+' ');
end;
writeln(' ');
textcolor(8);
read;
writeln( );
(*pocet znaku*)
textcolor(14);
for s:= 'A' to 'z' do
begin
a[s]:=0;
for II:= 1 to length(text) do
begin
if s = text[II] then a[s]:=a[s]+1;
end;
write('pocet ':3,s,' je ',a[s],' ':4);
end;
readln;
(*soucet cisel*)
textcolor(10);
for II:= 1 to length(text) do
begin
if (text[II]>='0') and (text[II]<='9') then
begin
write(text[II]+ ' ');
suma := suma + byte(text[II])-byte('0');
end;
end;
writeln('');
writeln;
writeln( 'soucet = ', suma);
readln;
end.
end.