Program read sentense to string

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: Homework in Pascal

Author: Kiko (ICQ 321-824-013)
Program: Slov_veta.pas
File exe: Slov_veta.exe

Program read sentense to string. During next time write count of letter of biggest word.
{ SLOV_VETA.PAS                                  Copyright (c) Kiko }
{ Program nacita vetu do stringu a nasledne vypise pocet pismen     }
{ v najdlhsom slove.                                                }
{                                                                   }
{ Datum:1.05.2007                              http://www.trsek.com }
 
uses crt;
var veta:string;
 x,a,b,c,d,e,z:integer;
 pocet:array [1..100] of integer;
 
begin
 clrscr;
 textcolor(4);
 gotoxy(60,22);
 writeln('...by Kiko !');
 gotoxy(60,24);
 writeln('321-824-013');
 gotoxy(60,25);
 writeln('SquierGuitar@Azet.sk');
 normvideo;
 
 
 gotoxy(19,1);
 writeln('!..zadaj nejaku vetu maximalne 100 slov..!');
 gotoxy(1,3);
 readln(veta);
 
 a:=length(veta);
 c:=0;
 x:=0;
 z:=0;
 veta[a+1]:=' ';
 
 for b:=1 to a+1 do
  begin
    if veta[b]<>' ' then c:=c+1
                    else begin
                          x:=x+1;
                          pocet[x]:=c;
                          if pocet[x]>z then z:=pocet[x];
                          c:=0;
                         end;
  end;
 
 gotoxy(21,5);
 writeln('pocet pismen v najdlhsiom slove je  ',z);
 readln;
end.