RosettaCodeData/Task/Find-the-missing-permutation/FreeBASIC/find-the-missing-permutatio...

28 lines
605 B
Plaintext

' version 30-03-2017
' compile with: fbc -s console
Data "ABCD", "CABD", "ACDB", "DACB", "BCDA", "ACBD"
Data "ADCB", "CDAB", "DABC", "BCAD", "CADB", "CDBA"
Data "CBAD", "ABDC", "ADBC", "BDCA", "DCBA", "BACD"
Data "BADC", "BDAC", "CBDA", "DBCA", "DCAB"
' ------=< MAIN >=------
Dim As ULong i,j
Dim As String tmp, missing = chr(0, 0, 0, 0) ' or string(4, 0)
For i = 1 To 23
Read tmp
For j = 0 To 3
missing[j] Xor= tmp[j]
Next
Next
Print "The missing permutation is : "; missing
' empty keyboard buffer
While Inkey <> "" : Wend
Print : Print "hit any key to end program"
Sleep
End