Qbasicnews.com
October 22, 2020, 09:30:59 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] 2 3
  Print  
Author Topic: HELP AGAIN  (Read 8769 times)
tomlewis86
New Member

Posts: 11


« on: June 04, 2003, 02:45:15 PM »

I'm making a program where you can select different people to be on you team in a quiz. When you choose a person i want to make that name visible in a team member screen. The code i thought of using was:

team.member = bob
PRINT team.member

All i get when i run this is the number 0!

Any suggestions?!

Tom. Shocked
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #1 on: June 04, 2003, 02:49:38 PM »

R T F M
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Ninkazu
Been there, done that
*****
Posts: 1169



WWW
« Reply #2 on: June 04, 2003, 02:54:59 PM »

Quote from: "Agamemnus"
R T F M


4 teh n00bs aote tare, tis menz red teh fckign manuel.
Logged

am an asshole. Get used to it.
tomlewis86
New Member

Posts: 11


« Reply #3 on: June 04, 2003, 03:08:33 PM »

WOT FUCKIN MANUAL!!

Did u just say that coz u dont know wot 2 do urself!!!??
Logged
Ninkazu
Been there, done that
*****
Posts: 1169



WWW
« Reply #4 on: June 04, 2003, 03:13:19 PM »

dude, you have to but quotes around a string, so this is what you have to do:

DIM team.member AS STRING
team.member = "bob"
PRINT team.member

n00b.
Logged

am an asshole. Get used to it.
tomlewis86
New Member

Posts: 11


« Reply #5 on: June 04, 2003, 03:18:02 PM »

i tried wot u sed but the message 'Type mismatch' came up!

Wot's wrong?

Tom.
Logged
Ninkazu
Been there, done that
*****
Posts: 1169



WWW
« Reply #6 on: June 04, 2003, 03:18:33 PM »

Quote from: "wizardlife"
They're copulating on my desk...


I hope you know "copulating" means to have sex in teh vagina.
Logged

am an asshole. Get used to it.
tomlewis86
New Member

Posts: 11


« Reply #7 on: June 04, 2003, 03:19:41 PM »

could u stop talkin bout copulating please n help me?
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #8 on: June 04, 2003, 03:28:30 PM »

In the QB main screen, Press ALT+C. Press H. Click on the DATA TYPES link. Click on the STRINGS list.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
prof_flex
Member
*
Posts: 37


« Reply #9 on: June 04, 2003, 04:02:16 PM »

team.member$ = "bob"
PRINT team.member$
Logged

LA BLA BLA
toonski84
__/--\__
*****
Posts: 2567



« Reply #10 on: June 04, 2003, 04:31:19 PM »

*sigh* the man asked a valid question.  Every time you yell "RTFM" at someone instead of answering their question, God kills a kitten.

There are different types of variables (a label representing a value) in qbasic:  Numeric (integer, long integer, single pres., double pres.), and string (fixed and regular).

you can't mix and match strings and numeric values, qb assumes all varaibles (in this case, team.member) to be single precision numbers.  So you have to specify that team.member is a string, either:

1) by referring to it as team.member$ (variables ending in $ are strings)
2) DIMing it as a string:
   
Code:
DIM team.member as string


afterwords, any string value must but in quotation marks, otherwise qb assumes it to be another variable (in this case, bob).

   
Code:

DIM team.member as string
team.member = "Bob"    
   
Logged

i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #11 on: June 04, 2003, 04:32:31 PM »

Quote from: "tomlewis86"
I'm making a program where you can select different people to be on you team in a quiz. When you choose a person i want to make that name visible in a team member screen. The code i thought of using was:

team.member = bob
PRINT team.member

All i get when i run this is the number 0!

Any suggestions?!

Tom. Shocked


bob isn't in quotes. so it is saying that team.member = the value a bob. Bob doesn't equal anything so it print 0.

Also
it should read

team.member$ = "bob"
PRINT team.member$

The variable team.member becomes a string when you out a $ on it. Then it says that it equals "bob".

if you put
team.member$ = bob
PRINT team.member$

YOu get a type mismatch because a string can't equal a non-string. If youy aren't confused by now. YOu should understand.  Smiley

EDIT:
toonski84 said it better. Also people... SAVE THE KITTENS
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #12 on: June 04, 2003, 05:15:36 PM »

Good! Now answer the file open one! I bet you can copy and paste at least 2 from the past half-week...
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Phydaux
Senior Member
**
Posts: 200



« Reply #13 on: June 04, 2003, 11:16:42 PM »

I don't mean to be anal here but this is the newbie help forum, where n00bs ask for help. It really doesn't help them by calling them n00bs, and telling them to RTFM when they are in a n00b forum. If you can't handle these questions (even if they pop up time-and-time again) don't look in the newbie help forum.

"He who asks a question is a fool for an hour, he who doesn't ask a question is a fool for ever" -Chinese proverb (probably paraphrased)
Logged

url=http://www.spreadfirefox.com/?q=affiliates&id=60131&t=79][/url]
END OF LINE.
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #14 on: June 04, 2003, 11:42:59 PM »

I don't do RTFM often..
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Pages: [1] 2 3
  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!