Advertisement
ridjis

ispravi

Dec 2nd, 2013
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  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. INC(i);
  31. ELSE
  32. jednak:=FALSE;
  33. END;
  34. END;
  35. IF duz AND jednak THEN
  36. WriteString('Stringovi su jednaki!');
  37. ELSE
  38. WriteString('Stringovi nisu jednaki!');
  39. END;
  40. END jednaki.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement