Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
41
Task/Caesar-cipher/FreeBASIC/caesar-cipher.freebasic
Normal file
41
Task/Caesar-cipher/FreeBASIC/caesar-cipher.freebasic
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Sub Encrypt(s As String, key As Integer)
|
||||
Dim c As Integer
|
||||
For i As Integer = 0 To Len(s)
|
||||
Select Case As Const s[i]
|
||||
Case 65 To 90
|
||||
c = s[i] + key
|
||||
If c > 90 Then c -= 26
|
||||
s[i] = c
|
||||
Case 97 To 122
|
||||
c = s[i] + key
|
||||
If c > 122 Then c -= 26
|
||||
s[i] = c
|
||||
End Select
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Sub Decrypt(s As String, key As Integer)
|
||||
Dim c As Integer
|
||||
For i As Integer = 0 To Len(s)
|
||||
Select Case As Const s[i]
|
||||
Case 65 To 90
|
||||
c = s[i] - key
|
||||
If c < 65 Then c += 26
|
||||
s[i] = c
|
||||
Case 97 To 122
|
||||
c = s[i] - key
|
||||
If c < 97 Then c += 26
|
||||
s[i] = c
|
||||
End Select
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Dim As String s = "Bright vixens jump; dozy fowl quack."
|
||||
Print "Plain text : "; s
|
||||
Encrypt s, 8
|
||||
Print "Encrypted : "; s
|
||||
Decrypt s, 8
|
||||
Print "Decrypted : "; s
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue