how to draw a square in qbasic with line statement
Answers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here's the code...........
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SCREEN 7
COLOR5,1
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bold indicates the code while Italics indicate the theory.....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Answer:
CLS
SCREEN 12
LINE (50, 50)-(150, 150), 3, B
END