QBasic is a programming language developed by Microsoft in 1985.It is the successor of earlier forms of BASIC (Beginners All-Purpose Symbolic Instruction Code).QBasic is an ideal programming language for beginners because of its simple commands, improved programming structures,better graphics and flexibility.It is an integrated development environment (IDE) to write, edit, debug and execute basic programs.
Now lets review some Qbasic programs.
- This program is used for draw an isosceles triangle with horizontal base.
COLOR4,14
CLS
PRINT "This is a Triangle"
LINE(160,30)-(250,180),4
LINE(250,180)-(70,180),2
LINE(70,180)-(160,30),1
END
2.This program is used for draw boxes with Line segment.
SCREEN 7
COLOR5,15
CLS
LINE(60,60)-(130,100),6,B
The letter B indicates the box option.In this statement,the coordinates (60,60) and (130,100) are the opposite corners of the rectangle.
To fill the box with the desired colour shade,add BF(box fill) option.
SCREEN 7
COLOR5,15
CLS
PRINT "This is a Rectangle"
LINE(60,60)-(130,100),6,BF
3.This program is used to generate musical notes.The codes used to produce different musical notes are as follows:
PLAY "ABCDEFGA"]
END
4.This program is used to draw a circle,eclipse or an arc of a circle.
SCREEN 7
COLOR4,14,5
CLS
PRINT "This is a Circle"
CIRCLE(160,100),70,15
END
5.This Program is to print table of 12(upto 5 times only.)
CLS
FORA=1 TO 5
PRINT"12*";A;"=";12*A
NEXTA
END
6.Program to display your name nine times on the screen.
CLS
REM PRINT YOUR NAME
INPUT "NAME PLEASE";N$
FOR X=1 TO 9
PRINT N$
NEXT X
END
7.Program to print first five odd numbers.
CLS
FOR L=1 TO 10 STEP 2
PRINT L
NEXT L
END
To fill the box with the desired colour shade,add BF(box fill) option.
SCREEN 7
COLOR5,15
CLS
PRINT "This is a Rectangle"
LINE(60,60)-(130,100),6,BF
3.This program is used to generate musical notes.The codes used to produce different musical notes are as follows:
PLAY "ABCDEFGA"]
END
4.This program is used to draw a circle,eclipse or an arc of a circle.
SCREEN 7
COLOR4,14,5
CLS
PRINT "This is a Circle"
CIRCLE(160,100),70,15
END
5.This Program is to print table of 12(upto 5 times only.)
CLS
FORA=1 TO 5
PRINT"12*";A;"=";12*A
NEXTA
END
6.Program to display your name nine times on the screen.
CLS
REM PRINT YOUR NAME
INPUT "NAME PLEASE";N$
FOR X=1 TO 9
PRINT N$
NEXT X
END
7.Program to print first five odd numbers.
CLS
FOR L=1 TO 10 STEP 2
PRINT L
NEXT L
END
0 Peoples tell for us:
Post a Comment
Your feedback is always appreciated. We will try to reply to your queries as soon as time allows.
Note:
1. Make sure to click the "Subscribe By Email" link below the comment to be notified of follow up comments and replies.
2. Please "Do Not Spam" - Spam comments will be deleted immediately upon our review.
3. Please "Do Not Add Links" to the body of your comment as they will not be published.
4. Only "English" comments shall be approved.
5. If you have a problem check first the comments, maybe you will find the solution there.