Data update
This commit is contained in:
parent
52a6ef48dd
commit
157b70a810
604 changed files with 14253 additions and 2100 deletions
42
Task/Caesar-cipher/FutureBasic/caesar-cipher.basic
Normal file
42
Task/Caesar-cipher/FutureBasic/caesar-cipher.basic
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
CFStringRef local fn Encrypt( s as CFStringRef, key as int )
|
||||
CFMutableStringRef s1 = fn MutableStringWithString(s)
|
||||
for int i = 0 to len(s1) - 1
|
||||
unichar c = ucc(s1,i)
|
||||
select
|
||||
case ( c >= _"A" && c <= _"Z")
|
||||
c += key : if ( c > _"Z" ) then c -= 26
|
||||
case ( c >= _"a" && c <= _"z" )
|
||||
c += key : if ( c > _"z" ) then c -= 26
|
||||
end select
|
||||
mid(s1,i,1) = ucs(c)
|
||||
next
|
||||
end fn = s1
|
||||
|
||||
CFStringRef local fn Decrypt( s as CFStringRef, key as int )
|
||||
CFMutableStringRef s1 = fn MutableStringWithString(s)
|
||||
for int i = 0 to len(s1) - 1
|
||||
unichar c = ucc(s1,i)
|
||||
select
|
||||
case ( c >= _"A" && c <= _"Z")
|
||||
c -= key : if ( c < _"A" ) then c += 26
|
||||
case ( c >= _"a" && c <= _"z" )
|
||||
c -= key : if ( c < _"a" ) then c += 26
|
||||
end select
|
||||
mid(s1,i,1) = ucs(c)
|
||||
next
|
||||
end fn = s1
|
||||
|
||||
void local fn DoIt
|
||||
CFStringRef s = @"The sun's not yellow, it's chicken"
|
||||
print s
|
||||
|
||||
s = fn Encrypt( s, 6 )
|
||||
print s
|
||||
|
||||
s = fn Decrypt( s, 6 )
|
||||
print s
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue