Advertisement
ridjis

Zadatak 4_2 nizovi string

Nov 8th, 2013
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MODULE zad42;
  2. FROM InOut IMPORT WriteLn, WriteString, WriteInt, WriteCard, ReadCard, ReadString;
  3. CONST max=256;
  4. TYPE string= ARRAY [1..max] OF CHAR;
  5. VAR i:INTEGER;
  6. string1, string2: string;
  7. jednak: BOOLEAN;
  8. BEGIN
  9.   WriteString('Unesite prvi string: ');
  10.   ReadString(string1);
  11.   WriteLn;
  12.  
  13.   WriteString('Unesite drugi string: ');
  14.   ReadString(string2);
  15.   WriteLn;
  16.   i:=1;
  17.   jednak:=TRUE;
  18.  
  19.   string1[i]:= CAP(string1[i]);
  20.   string2[i]:= CAP(string2[i]);
  21.    
  22.   WHILE (string1[i] # 0C) AND (string2[i] # 0C) AND jednak DO
  23.     IF string1[i]=string2[i] THEN
  24.         INC(i);
  25.     ELSE
  26.         jednak:=FALSE;
  27.     END;
  28.   END;
  29.   IF jednak THEN
  30.     WriteString('Stringovi su jednaki. ');
  31.   ELSE
  32.     WriteString('Stringovi nisu jednaki. ');
  33.   END;
  34.   WriteLn;
  35. END zad42.
  36.  
  37. (* string1[i]:=CHR(ORD(string1[i])+ORD('a')-ORD('A'));
  38.      string2[i]:=CHR(ORD(string2[i])+ORD('a')-ORD('A')); *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement