When you open QBasic, you see a blue screen where you can type your program. Let’s begin with the QBasic commands that are important in any program.
PRINT
Command PRINT displays text or numbers on the screen.
The program line looks like this:
PRINT “My name is Nick.”
Type the bolded text into QBasic and press F5 to run the program. On the screen you’ll see
My name is Abhijeet.
Note: you must put the text in quotes, like this – “text”. The text in quotes is called a string.
If you put the PRINT alone, without any text, it will just put an empty line.
PRINT can also put numbers on the screen.
PRINT 57 will show the number 57. This command is useful for displaying the result of mathematical calculations. But for calculations, as well as for other things in the program, you need to use variables.
Command PRINT displays text or numbers on the screen.
The program line looks like this:
PRINT “My name is Nick.”
Type the bolded text into QBasic and press F5 to run the program. On the screen you’ll see
My name is Abhijeet.
Note: you must put the text in quotes, like this – “text”. The text in quotes is called a string.
If you put the PRINT alone, without any text, it will just put an empty line.
PRINT can also put numbers on the screen.
PRINT 57 will show the number 57. This command is useful for displaying the result of mathematical calculations. But for calculations, as well as for other things in the program, you need to use variables.
No comments:
Write comments