Creative Basic - Example Programs

Example Programs

"Hello" program:

print "hello"

Program to open a Console window and print 10 random numbers:

openconsole for i = 1 to 10 x = Rnd(100) print x next i do:until inkey$<>"" closeconsole end

Program to create a GUI window with an Exit button and event handling routine:

def w:WINDOW def wstyle:INT wstyle = @SIZE|@MINBOX|@MAXBOX WINDOW w,50,50,800,600,wstyle,0,"Window Title",main SETWINDOWCOLOR w,RGB(0,0,90) CONTROL w,"B,Exit,(800-80)/2, 500, 80, 40, 0, 1" WAITUNTIL w = 0 END SUB main SELECT @CLASS case @IDCLOSEWINDOW closewindow w ' clicking the Exit button ... case @IDCONTROL select @CONTROLID case 1 closewindow w endselect endselect RETURN

Read more about this topic:  Creative Basic

Famous quotes containing the word programs:

    “Government ... thought [it] could transform the country through massive national programs, but often the programs did not work. Too often they only made things worse. In our rush to accomplish great deeds quickly, we trampled on sound principles of restraint and endangered the rights of individuals.”
    —Gerald R. Ford (b. 1913)

    “Will TV kill the theater? If the programs I have seen, save for “Kukla, Fran and Ollie,” the ball games and the fights, are any criterion, the theater need not wake up in a cold sweat.”
    —Tallulah Bankhead (1903–1968)