Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*program koji ucitava dva stringa i ispisuje da li su jednaki*)
- MODULE jednaki;
- FROM InOut IMPORT WriteString, ReadString, WriteLn;
- FROM Str IMPORT Length;
- TYPE NIZ=ARRAY [1..256] OF CHAR;
- VAR s1,s2: NIZ;
- i: CARDINAL;
- duz, jednak: BOOLEAN;
- BEGIN
- WriteString('Unesite prvu rijec: ');
- ReadString(s1);
- WriteLn;
- WriteString('Unesite drugu rijec: ');
- ReadString(s2);
- WriteLn;
- duz:= TRUE;
- IF Length(s1) # Length(s2) THEN
- duz:=FALSE;
- END;
- i:=1;
- WHILE (s1[i]#0C) AND (s2[i]#0C) DO
- s1[i]:=CAP(s1[i]);
- s2[i]:=CAP(s2[i]);
- INC(i);
- END;
- jednak:=TRUE;
- i:=1;
- WHILE (s1[i]#0C) AND (s2[i]#0C) AND jednak DO
- IF (s1[i]=s2[i]) THEN
- INC(i);
- ELSE
- jednak:=FALSE;
- END;
- END;
- IF duz AND jednak THEN
- WriteString('Stringovi su jednaki!');
- ELSE
- WriteString('Stringovi nisu jednaki!');
- END;
- END jednaki.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement