If you are an old timer like me, and have used Basic or Qbasic in the past, here is a nifty package ...
Quote:
BCX the BASIC To C Translator:
Pro:
- simple basic syntax
- easy to write console or GUI code
- translates to C code and then compiles the C code
- you can view and change the C code
- good help file
- lots of examples
- active forum
- comes in a package including editor/IDE and C compiler
also has a Visual Basic like IDE and form builder
BCX DevSuite Pro from: BCX DevSuite Pro at RJP Computing
Con:
- C code might be just another layer for some
|
Here is typical BCX code ...
Code:
' look at a series of numbers and print out the prime numbers
' prime numbers are divisible only by unity or themselves
' this is BCX basic, a modern successor to Qbasic
Dim A ' defaults to integer
For A = 1 To 100
If IsPrime(A) Then Print A;
Next
Pause ' make console wait
Function IsPrime(Num)
Local X
' make exeptions for 1 and 2
If Num = 1 Then Function = False
If Num = 2 Then Function = True
' leave on even numbers
If Mod(Num, 2) = 0 Then Exit Function
For X = 3 To Num - 1 Step 2
If Mod(Num, X) = 0 Then Exit Function
Next X
Function = TRUE ' return true if it's a Prime Number
End Function
Or a simple example of GUI code ...
Code:
' test listbox selection
GUI "ListBox1", PIXELS
SET names[7][10] AS char
"Heidi", "Bertha", "Samantha", "Rubin",
"Frank", "Sandy", "Sunny"
END SET
DIM text$
DIM Form1 AS HWND
DIM List1 AS HWND
SUB FORMLOAD
LOCAL A$, k
Form1 = BCX_FORM("Click on a name ...", 0, 0, 260, 200)
List1 = BCX_LISTBOX("", Form1, 1009, 10, 15, 100, 150)
FOR k = 0 TO 6
A$ = names[k]
addLB(List1, A$) ' load list1 via sub
NEXT
CENTER(Form1)
SHOW (Form1)
END SUB
BEGIN EVENTS
SELECT CASE CBMSG
CASE WM_COMMAND
' list box item clicked (selected)
IF CBCTL = 1009 THEN
IF CBCTLMSG = LBN_SELCHANGE THEN
text$ = getLB$(List1)
' just for test
Beep(400,500)
' selected item to form title
SetWindowText(Form1, text$)
END IF
END IF
END SELECT
END EVENTS
' add a string
SUB addLB(idnr as HWND,ltext$)
SendMessage(idnr,LB_ADDSTRING,0,ltext$)
END SUB
' return selected string
Function getLB$(idnr as HWND)
LOCAL index, buf$
index = SendMessage(idnr,LB_GETCURSEL,0,0)
SendMessage (idnr,LB_GETTEXT,index,buf$)
Function = buf$
END Function