Advertisement
ridjis

zadatak 42_3

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