Results 1 to 1 of 1

Thread: FreeBasic QB Mode

  1. #1

    FreeBasic QB Mode

    if you want to use freebasic to run quick basic programs, you must add this '$lang: "qb" to the top of the code
    yes there is " ' "
    only '$lang: "qb" will work to enable QB mode albeit there are several suggestions in the forums but does not work
    examples:
    C:\FreeBASIC\examples\manual\control\gosub.bas
    '' Compile with -lang qb
    '$lang: "qb"
    GoSub message
    End
    message:
    Print "Welcome!"
    dim s as string
    input "press enter to exit ", s
    Return
    
    example 2:
    '$lang: "qb"
    DECLARE FUNCTION Add! (num1!, num2!)
    PRINT Add(10, 7)
    INPUT "Press ENTER to exit", C$
    
    FUNCTION Add (num1, num2)
    Add = num1 + num2
    END FUNCTION
    
    the above examples will work from within the fbide. but i can't make it to run from inside thinbasic #Compiled #Endcompiled . thinbasic seems confused by the '$lang: "qb"

    example 3:
    caesar cipher CIPHER1.BAS from page 46 of the book Learn Encryption Techniques with BASIC and C++ ( 1998 ) the basic examples are for QB with many nice Goto and Gosub functions.
    https://archive.org/details/LearnEnc...e/n46/mode/2up
    REM PROGRAM CIPHER1.BAS
    ' Compile with -lang qb
    
    '$lang: "qb"
    DIM PLAINTEXT$(25), CIPHERTEXT$(25)
    GOSUB INITIALIZE
    1 INPUT "Enter UPPERCASE Alphabetic Shift Key: ", K$
    FOR I = 0 TO 25
    IF K$ = PLAINTEXT$(I) GOTO 2
    NEXT I
    PRINT "You must enter a letter from A to Z"
    GOTO 1
    2 REM Position I represents shift key letter
    GOSUB FORMCIPHER
    GOSUB PRTOUT
    INPUT "Press ENTER ", C$
    STOP
    INITIALIZE:
    REM Initialize plaintext values
    FOR I = 0 TO 25
    READ PLAINTEXT$(I)
    NEXT I
    DATA "A","B","C","D","E","F","G","H","I","J","K","L","M","N"
    DATA "O","P","Q","R","S","T","U","V","W","X","Y","Z"
    RETURN
    FORMCIPHER:
    REM Routine to form CIPHERTEXT alphabet based upon defined shift key
    J = I + 1
    FOR K = 0 TO 25
    CIPHERTEXT$(K) = PLAINTEXT$((K + J) MOD 26)
    NEXT K
    RETURN
    PRTOUT:
    REM Print results
    FOR I = 0 TO 25
    PRINT CIPHERTEXT$(I);
    NEXT I
    PRINT
    RETURN
    END
    
    Last edited by primo; 30-03-2022 at 16:45.

Similar Threads

  1. XP-Mode
    By ReneMiner in forum General
    Replies: 1
    Last Post: 04-04-2020, 16:33
  2. Replies: 4
    Last Post: 04-03-2014, 16:05
  3. windows 7 compatibily mode
    By zak in forum Shout Box Area
    Replies: 2
    Last Post: 13-05-2011, 15:13

Members who have read this thread: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •