from LinkString import LinkString
def StrEqueal(s,t):
if s.getsize()!=t.getsize(): #不等长一定不相等
return False
p=s.head.next
q=t.head.next
while p!=None and q!=None:
if p.data!=q.data: #等长时对比对应位字符是否相同
return False
p=p.next
q=q.next
return True;
cstr1="abcd"
s1=LinkString()
s1.StrAssign(cstr1)
print("s1: ",end='');s1.DispStr()
cstr2="abcd"
s2=LinkString()
s2.StrAssign(cstr2)
print("s2: ",end='');s2.DispStr()
print(StrEqueal(s1,s2))
标签:return,s2,s1,next,EXAM4,print,LinkString From: https://www.cnblogs.com/simple-one/p/17770232.html