Advertisement
ridjis

Leksikografski

Dec 4th, 2013
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (* UCITAVA DVA STRINGA I ISPISUJE KOJI JE PRVI LEKSIKOGRAFSKI *)
  2. MODULE rz42;
  3. FROM InOut IMPORT WriteLn, WriteString,ReadString;
  4. FROM Str IMPORT Length;
  5. TYPE NIZ = ARRAY [1..256] OF CHAR;
  6. VAR str1,str2: NIZ;
  7.     b1,b2,b3,i,do: CARDINAL;
  8. BEGIN
  9.   WriteString('Unesite prvu rijec: ');
  10.   ReadString(str1);
  11.   WriteString('Unesite drugu rijec: ');
  12.   ReadString(str2);
  13.   IF Length(str1) > Length(str2) THEN
  14.     do:=Length(str1)
  15.   ELSE
  16.     do:=Length(str2);
  17.   END;
  18.   FOR i:=1 TO do DO
  19.     IF (str1[i] = str2[i]) THEN
  20.       INC(b1);
  21.     ELSIF str1[i]<str2[i] THEN
  22.       INC(b2);
  23.     ELSE
  24.       INC(b3);
  25.     END;
  26.   END;
  27.   IF b1=do THEN
  28.     WriteString('Stringovi su isti');
  29.   ELSIF b2#0 THEN
  30.     WriteString('prvi string je prvi po redu.');
  31.     WriteLn;
  32.     WriteLn;
  33.     WriteString(str1);
  34.     WriteLn;
  35.     WriteString(str2);
  36.   ELSE
  37.     WriteString('prvi string je drugi po redu.');
  38.     WriteLn;
  39.     WriteLn;
  40.     WriteString(str2);
  41.     WriteLn;
  42.     WriteString(str1);
  43.   END;
  44.   WriteLn;
  45. END rz42.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement