Qbasicnews.com
April 09, 2020, 08:07:46 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how do u display text  (Read 1460 times)
fusion_X5
New Member

Posts: 2


« on: March 12, 2003, 01:16:31 AM »

how do u display text
Logged
Rokkuman
Na_th_an
*****
Posts: 1973



« Reply #1 on: March 12, 2003, 01:23:49 AM »

Hi RYAN... just so you know... it's not a good idea to use words like u instead of you. It just looks so un professional...

To display text in QB. Inside the program, you type PRINT "<text here>" So if you want to display. "I eat dogs", you would type.

Code:

PRINT "I eat dogs"


Whatever you want displayed goes in quotations. If you leave out quotations, what you type will be counted as variables... which you'll learn about soon.

http://www.qbasic.com/frames.shtml
Go here... you will learn the basics of Qbasic and someday, become a qbasic master like me...
Logged
Rokkuman
Na_th_an
*****
Posts: 1973



« Reply #2 on: March 12, 2003, 02:06:09 AM »

Ok, since you asked in Messenger, I'll just tell you here...

A Variable is just a value. Example:

Apples = 50
Oranges = 54
Cheeses = 50
Dogs = 34

In the first one, Apples would be the variable and 50 would be the value. Variables are like, the most important thing in programming.
So in QBasic, if you wanted A to be 50 , then it would be as simple as...

Code:


A = 50



And tadah, A is equal to 50. You can make 50 into a different number if you want.

You can use A in place of other numbers.

(By the way, using the PRINT command. If you want it to put the value of a variable, put the variable OUT of the parenthesis, so it would look like.

Code:


Apples = 849
PRINT "PJ Haye has " ;Apples " dollars."



If you noticed, I said dollars, even though the variable was apples, what the variable *says* doesn't matter, but it makes it easier to know what you're talking about.)

I actually gave an example up there. Let me break it apart.

Code:


Apples = 849

This is saying that the Value of Apples is equal to 849. This can be changes to whatever you want. If you want the value to be text, you must add a dollar sign to the end of the variable

Code:

PRINT "PJ Haye has" ;Apples " dollars."


This will make it say "PJ Haye has 849 dollars." It does this because I use the PRINT command to display the text. Whatever is in the quotations is what it says no matter what, whatever is out, will make it show the value. So if apples was inside the quotations, then it would say, "PJ Haye has ;Apples dollars.", and that's just plain weird. Also, before a variable in a print command, you put a semicolon ; . If you forget to add it, QB should add it automatically.

I hope this helped you. I know it did.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!