home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
das_buch
/
profiler
/
comp2.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-05-03
|
1KB
|
55 lines
(* ------------------------------------------------------ *)
(* COMP2.PAS *)
(* (c) 1993 te-wi Verlag, München *)
(* ------------------------------------------------------ *)
PROGRAM Compare_2;
{$A+,B-,D+,E+,F-,G-,I+,L+,N-,O-,P-,Q+,R+,S+,T-,V+,X+,Y+}
{$M 16384,0,655360}
TYPE
Quality = (Lss, Gtr, Eql);
FUNCTION Compare(s1, s2 : STRING) : Quality;
VAR
t1, t2 : STRING;
FUNCTION UpStr(s1 : STRING) : STRING;
VAR
s : STRING;
i : INTEGER;
BEGIN
s := '';
FOR i := 1 TO Length(s1) DO
s := s + UpCase(s[i]);
UpStr := s;
END;
BEGIN
t1 := UpStr(s1);
t2 := UpStr(s2);
IF t1 = t2 THEN
Compare := Eql
ELSE IF t1 > t2 THEN
Compare := Gtr
ELSE IF t1 < t2 THEN
Compare := Lss;
END;
CONST
s1 : STRING = 'begin';
s2 : STRING = 'abs';
s3 : STRING = 'compare';
s4 : STRING = 'zappenduster';
BEGIN
WriteLn(Ord(Compare(s1, s2)));
WriteLn(Ord(Compare(s4, s1)));
WriteLn(Ord(Compare(s4, s4)));
WriteLn(Ord(Compare(s3, s4)));
END.
(* ------------------------------------------------------ *)
(* Ende von COMP2.PAS *)