Wednesday, 2024-12-18, 9:17 PM

Welcome Guest | RSS

MainRegistrationLogin
Qbasic Home

Catalog categories
Qbasic Tutorial [31]

Rate my Site
Rate JPSor Site
Total of answers: 168

Main » Articles » Qbasic Tutorial

Chapter 18 - Qbasic Tutorial

LOCATE allows you to print in a specific place on the screen.

 CLS
LOCATE 5, 10
PRINT "Here"
LOCATE 20, 70
PRINT "There"

The two numbers after LOCATE are the coordinates where the print will be. Just like coordinates in math class, these numbers give the row and the column. The first number in LOCATE is the row, or how far down the screen the print will start. The second number is the column, or how far over the print will start.

Let's use some random numbers, COLOR and LOCATE to make a more interesting version of our first looping program:

 CLS
DO
Row = INT(RND * 23 + 1)
Column = INT(RND * 79 + 1)
LOCATE Row, Column
Color1 = INT(RND * 15 + 1)
COLOR Color1, 0
PRINT "Ted was here!";
LOOP

Kind of messy, but interesting.

How about a clock?

 CLS
DO
LOCATE 1, 1
PRINT TIME$
SLEEP 1
LOOP

TIME$ is a special variable that contains the current time. Press Break to stop.



Source: http://jpsor.ucoz.com
Category: Qbasic Tutorial | Added by: JPSor (2009-02-26) | Author: JPSor
Views: 1547 | Rating: 0.0/0 |
Login

Qbasic Clock

Search

Visit my Friends

Who's Online

Total online: 1
Guests: 1
Resgistered: 0


Copyright MyCorp © 2024