Monday, January 19, 2015

Graphics on QBASIC

                  Hey, Viewers !  Here are some interesting QBASIC programmes especially for SLC students for broadening their concept on programming. These programmes are beyond curriculum of SLC. Its just for extra knowledge and for fun.   



1.          Write a programme in QBASIC to make a circle of radius 25 units..(   Syntax:CIRCLE (x-coordinate,y-coordinate),radius,[color].....    )
Ans:
                        CLS
                     SCREEN 13
                     CIRCLE (50,50),25
                      END
                    


2.          Write a programme in QBASIC to make a circle of radius 50 units and fill any color in boarder.
Ans:
                     CLS
                     SCREEN 13
                     CIRCLE (50,50),50,10                      
                      END
      Note: It shows green color in circles boarder.        


3.          Write a programme in QBASIC to make a circle which can move in any direction and terminate as required or ordered by User.

Ans:
                      
DIM KeyPress  AS STRING
                      DIM x AS INTEGER
                      DIM y AS INTEGER

                      x = 159
                      y = 99

                      SCREEN 13

                      CLS

                      DO

    
                      KeyPress = UCASE$(INKEY$)

    
                      IF KeyPress = "W" THEN                               
                           CLS
                           y = y - 1
                 ELSEIF KeyPress = "S" THEN   
                           CLS
                           y = y + 1
                         ELSEIF KeyPress = "A" THEN   
                           CLS
                           x = x - 1
                         ELSEIF KeyPress = "D" THEN  
                           CLS
                           x = x + 1
                         END IF

   
                       CIRCLE (x, y), 25, 10

                      LOOP UNTIL KeyPress = "Q"   

                        Note: If pressed "W" then it moves in upward direction.
                                    If pressed "S" then it moves in downward direction.
                                     If pressed "A" then it moves in  left direction.
                                     If pressed "D" then it moves in right direction.
                                      If pressed "Q" the programme terminates.




Note: More interesting things will be published soon. Please do comment if you like my work and I recommend you to visit website https://www.qbasicsolutions.blogspot.com. Here you will find lots of QBASIC SLC solution and other practice
materials which will help you to boost your knowledge on QBASIC. Similarly, If you have any problem 
regarding computer subject
you can ask question on that blog site. Deepak Shrestha, computer teacher of Jagat Mandir School, will help you out.
.Thanks for visit.Take care.