Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
106
Task/String-comparison/Action-/string-comparison.action
Normal file
106
Task/String-comparison/Action-/string-comparison.action
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
PROC TestEqual(CHAR ARRAY s1,s2)
|
||||
INT res
|
||||
|
||||
PrintF("""%S"" and ""%S"" are equal: ",s1,s2)
|
||||
IF SCompare(s1,s2)=0 THEN
|
||||
PrintE("True")
|
||||
ELSE
|
||||
PrintE("False")
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC TestInequal(CHAR ARRAY s1,s2)
|
||||
INT res
|
||||
|
||||
PrintF("""%S"" and ""%S"" are inequal: ",s1,s2)
|
||||
IF SCompare(s1,s2)#0 THEN
|
||||
PrintE("True")
|
||||
ELSE
|
||||
PrintE("False")
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC TestBefore(CHAR ARRAY s1,s2)
|
||||
INT res
|
||||
|
||||
PrintF("""%S"" is before ""%S"": ",s1,s2)
|
||||
IF SCompare(s1,s2)<0 THEN
|
||||
PrintE("True")
|
||||
ELSE
|
||||
PrintE("False")
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC TestAfter(CHAR ARRAY s1,s2)
|
||||
INT res
|
||||
|
||||
PrintF("""%S"" is after ""%S"": ",s1,s2)
|
||||
IF SCompare(s1,s2)>0 THEN
|
||||
PrintE("True")
|
||||
ELSE
|
||||
PrintE("False")
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC TestNumEqual(CHAR ARRAY s1,s2)
|
||||
INT v1,v2
|
||||
|
||||
PrintF("""%S"" and ""%S"" are equal: ",s1,s2)
|
||||
v1=ValI(s1) v2=ValI(s2)
|
||||
IF v1=v2 THEN
|
||||
PrintE("True")
|
||||
ELSE
|
||||
PrintE("False")
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC TestNumInequal(CHAR ARRAY s1,s2)
|
||||
INT v1,v2
|
||||
|
||||
PrintF("""%S"" and ""%S"" are inequal: ",s1,s2)
|
||||
v1=ValI(s1) v2=ValI(s2)
|
||||
IF v1#v2 THEN
|
||||
PrintE("True")
|
||||
ELSE
|
||||
PrintE("False")
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC TestNumBefore(CHAR ARRAY s1,s2)
|
||||
INT v1,v2
|
||||
|
||||
PrintF("""%S"" is before ""%S"": ",s1,s2)
|
||||
v1=ValI(s1) v2=ValI(s2)
|
||||
IF v1<v2 THEN
|
||||
PrintE("True")
|
||||
ELSE
|
||||
PrintE("False")
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC TestNumAfter(CHAR ARRAY s1,s2)
|
||||
INT v1,v2
|
||||
|
||||
PrintF("""%S"" is after ""%S"": ",s1,s2)
|
||||
v1=ValI(s1) v2=ValI(s2)
|
||||
IF v1>v2 THEN
|
||||
PrintE("True")
|
||||
ELSE
|
||||
PrintE("False")
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
PrintE("Lexical comparison:")
|
||||
TestEqual("abcd","Abcd")
|
||||
TestInequal("abcd","Abcd")
|
||||
TestBefore("abcd","Abcd")
|
||||
TestAfter("abcd","Abcd")
|
||||
PutE()
|
||||
|
||||
PrintE("Numerical comparison:")
|
||||
TestNumEqual("1234","99876")
|
||||
TestNumInequal("1234","99876")
|
||||
TestNumBefore("1234","99876")
|
||||
TestNumAfter("1234","99876")
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue