Home Photogallery Downloads Programming Time-Pass Reading Harry Potter Jokes Section Favourite Friendcircle Mail Me

 Tuesday August 24, 2004               


WRITING A PROGRAM

Using the keys explained above, you can now write a GWBASIC program and make any modifications needed. For example, type in the short program below. When entering a program, you must always press the <Return> key at the end of each line so that the computer will accept the line into memory.
10 REM THIS PROGRAM WILL ADD TWO NUMBERS
20 REM
30 PRINT " PLEASE ENTER THE FIRST NUMBER " ;
40 INPUT A
50 PRINT " PLEASE ENTER SECOND " ;
60 INPUT B
70 LET TOTAL = A + B
80 PRINT " THE TOTAL OF THE TWO NUMBERS IS " TOTAL
90 END

LIST

<List> shows that what you have entered.

If you have made a mistake anywhere on the current line, use the <BackSpace>key to correct and retype. Once the program is in memory, you can list (display) your program with the LIST command. At the Ok prompt, type

LIST

The program currently in memory will be listed. At the Ok prompt you can make any changes to what is on the screen.For instance, move to line 50 and change it to read:

50 PRINT " PLEASE ENTER THE SECOND NUMBER " ;

Note that, once you have made any changes you must press the <Return> key on that line before moving to another.

SAVING A PROGRAM

Your program is kept in memory as long as the computer is on and you do not execute the LOAD command. If you would like to save your newly written  program, you must enter the SAVE command. To do so, type

SAVE "B:filename

where B: is the drive on which you are storing the file and  filename is the name you are giving to the program. A filename can be  up to 8 characters long and must start with a letter. It cannot have any special characters -- only letters and numbers.

 will show you how to move the cursor on the screen.

<Arrow Keys>

move the cursor one position in each corresponding direction. Note that if the cursor is moved beyond the right or left edge of the screen, it will appear at the opposite side of the screen.

<Home>

moves the cursor to the top left-hand corner of the screen.

<End>

moves the cursor to the end of the current line.

<Ctrl><Right Arrow>

moves the cursor to the beginning of the next word.

<Ctrl><Left Arrow>

moves the cursor to the beginning of the previous word.

<Delete>

deletes the character the cursor is on.

<Back Space>

deletes the character to the left of the cursor.

<Insert>

switches you in and out of insert mode. If insert mode is on, the cursor is a blinking half-height block. In the overwrite mode, the characters typed will replace existing characters on the line. In insert mode, existing characters will move to the right as new characters are typed. Insert mode is turned off when you press the <Insert> key again.

<Ctrl><End>

erases from the current cursor position to the end of the current line.


Previous Page

Next Page

Google

Home Photogallery Downloads Programming Time-Pass Reading Harry Potter Jokes Section Favourite Friendcircle Mail Me

Hosted by www.Geocities.ws

1