Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Generic-swap/FreeBASIC/generic-swap.basic
Normal file
26
Task/Generic-swap/FreeBASIC/generic-swap.basic
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
' FB 1.05.0
|
||||
#Macro Declare_Swap(T)
|
||||
Sub Swap_##T(ByRef t1 As T, ByRef t2 As T)
|
||||
Dim temp As T = t2
|
||||
t2 = t1
|
||||
t1 = temp
|
||||
End Sub
|
||||
#EndMacro
|
||||
|
||||
Dim As Integer i, j
|
||||
i = 1 : j = 2
|
||||
|
||||
Declare_Swap(Integer) ' expands the macro
|
||||
Swap_Integer(i, j)
|
||||
Print i, j
|
||||
|
||||
Dim As String s, t
|
||||
s = "Hello" : t = "World"
|
||||
|
||||
Declare_Swap(String)
|
||||
Swap_String(s, t)
|
||||
Print s, t
|
||||
|
||||
Print
|
||||
Print "Press any key to exit"
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue