Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* UCITAVA DVA STRINGA I ISPISUJE KOJI JE PRVI LEKSIKOGRAFSKI *)
- MODULE rz42;
- FROM InOut IMPORT WriteLn, WriteString,ReadString;
- FROM Str IMPORT Length;
- TYPE NIZ = ARRAY [1..256] OF CHAR;
- VAR str1,str2: NIZ;
- b1,b2,b3,i,do: CARDINAL;
- BEGIN
- WriteString('Unesite prvu rijec: ');
- ReadString(str1);
- WriteString('Unesite drugu rijec: ');
- ReadString(str2);
- IF Length(str1) > Length(str2) THEN
- do:=Length(str1)
- ELSE
- do:=Length(str2);
- END;
- FOR i:=1 TO do DO
- IF (str1[i] = str2[i]) THEN
- INC(b1);
- ELSIF str1[i]<str2[i] THEN
- INC(b2);
- ELSE
- INC(b3);
- END;
- END;
- IF b1=do THEN
- WriteString('Stringovi su isti');
- ELSIF b2#0 THEN
- WriteString('prvi string je prvi po redu.');
- WriteLn;
- WriteLn;
- WriteString(str1);
- WriteLn;
- WriteString(str2);
- ELSE
- WriteString('prvi string je drugi po redu.');
- WriteLn;
- WriteLn;
- WriteString(str2);
- WriteLn;
- WriteString(str1);
- END;
- WriteLn;
- END rz42.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement