Advertisement
ridjis

ispravljeno

Dec 4th, 2013
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (*program koji ucitava dva stringa i ispisuje da li su jednaki*)
  2. MODULE jednaki;
  3. FROM InOut IMPORT WriteString, ReadString, WriteLn;
  4. FROM Str IMPORT Length;
  5. TYPE NIZ=ARRAY [1..256] OF CHAR;
  6. VAR s1,s2: NIZ;
  7.     i: CARDINAL;
  8.     duz, jednak: BOOLEAN;
  9. BEGIN
  10.   WriteString('Unesite prvu rijec: ');
  11.   ReadString(s1);
  12.   WriteLn;
  13.   WriteString('Unesite drugu rijec: ');
  14.   ReadString(s2);
  15.   WriteLn;
  16.   duz:= TRUE;
  17.   IF Length(s1) # Length(s2) THEN
  18.     duz:=FALSE;
  19.   END;
  20.   i:=1;
  21.   WHILE (s1[i]#0C) AND (s2[i]#0C) DO
  22.     s1[i]:=CAP(s1[i]);
  23.     s2[i]:=CAP(s2[i]);
  24.     INC(i);
  25.   END;
  26.   jednak:=TRUE;
  27.   i:=1;
  28.   WHILE (s1[i]#0C) AND (s2[i]#0C) AND jednak DO
  29.     IF (s1[i]#s2[i]) THEN
  30.       jednak:=FALSE;
  31.     END;
  32.     INC(i);
  33.   END;
  34.   IF duz AND jednak THEN
  35.     WriteString('Stringovi su jednaki!');
  36.   ELSE
  37.     WriteString('Stringovi nisu jednaki!');
  38.   END;
  39. END jednaki.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement