整数与宏连接

时间:2017-09-18 03:16:33

标签: console integer basic freebasic

如何使用宏正确连接整数? 我必须在这里打电话两次,因为我不能在"之后添加一些东西,"(错误)

#define concat(a,b,c) a##b##c
dim as integer a=10,b=20,c=30,d
d = a concat(*100+,,)b
d = d concat(*100+,,)c
?d  'output = 102030
sleep

2 个答案:

答案 0 :(得分:1)

 Private Async Sub QrScanned(jsonString As String)
    My.Computer.Audio.Play(My.Resources.ScannerBeep, AudioPlayMode.Background)
    Try
        If jsonString.Contains("UID") Then
            if Await CheckBookInList 'Checks and returns book if found
                GetData("MEM-0001")
                await Task.Delay(200)
                _sendImage.Start()
            ElseIf await BookService.Borrowed("BOOK-2","MEM-0001") 
                    GetData("MEM-0001")
                await task.Delay(200)
                _sendImage.Start()
            Else 
                MsgBox("Failed to Update database")
            End If
        else
            MsgBox("Please scan a book to add or return")
        End If
    Catch ex As Exception
        msgbox(ex.ToString())
    End Try


End Sub

答案 1 :(得分:0)

我从freebasic论坛找到了一个解决方案

#define concat(a,b,c)  (((a)*100+(b))*100+(c))
dim as integer a=10,b=20,c=30,d
d = concat(a,b,c)
?d  'output = 102030
sleep