It was probably a bit hard to find your messages on the screen with that last program. Wouldn't it be nice to be able to clear all that stuff off the screen? "CLS", which stands for CLear Screen, is just the ticket. You will need to put CLS at the very top of your program to clear the screen before you print anything.
Inserting a new line at the top.
To make CLS the first line of your program, follow these steps:
- Press the <Home> key to get to the beginning of the current line.
- Press the <Up Arrow> key once or twice to get the cursor to the top of the program.
- Press the <Enter> key to get a new line.
- Press the <Up Arrow> key once to get the cursor on the new blank line.
- Type CLS
Now your program should look like this:
CLS
PRINT "Welcome to QBASIC. Your wish is my command."
PRINT "Programming is fun."
Run it. Remember, click on Run and then Start in QBASIC's menu. You can also run the program by pressing the <Shift> key and holding it down while pressing <F5> (that's what Shift+F5 means on the menu). Another handy shortcut.
That's much better. Only your message is on the screen, which is the way it should be.
Learned
- CLS
- Shift+F5
No comments:
Post a Comment