Qbasicnews.com
February 26, 2020, 02:17:44 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: I need some help in this since im new  (Read 9245 times)
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #15 on: March 19, 2006, 02:24:53 PM »

Zack: overflow error.  Sad
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.
Mac
Senior Member
**
Posts: 243


WWW
« Reply #16 on: April 05, 2006, 10:49:07 PM »

Quote from: "Agamemnus"
Fine fine na_th_an... you win...


A man is wise to the extent he can renege on previous statements.

You have been shown here to be wise.

If you have nothing else to do and can write cryptographic-type stuff or file-handling, I need a volunteer. Just start a new thread on
http://www.network54.com/Forum/188265/
asking what is needed. (Or send me an email)

Mac
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #17 on: April 06, 2006, 04:28:30 AM »

I've always said that Agamemnus is one of the best programmers in this forums.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
axipher
Ancient Guru
****
Posts: 544



« Reply #18 on: April 06, 2006, 02:26:53 PM »

NO NO NO, his first mistake was DIMing I(2) and and thinking that gives I(0), I(1), and I(2), DIMing I(2) gives 2 values for I starting at index 0, same thing for P.  Now there's 2 solutions if you want to access I(0) to I(2):

Code:
DIM I(3) AS CAR
-OR-
Code:
DIM I(0 TO 2)


Both give the same results, but the second one can allow you to make the array start at index 1 and go to 3.
Logged
DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #19 on: April 06, 2006, 03:06:11 PM »

An array dimensioned with DIM I(2) has 3 elements I(0), I(1), and I(2), unless OPTION BASE 1 is in effect.  This is different from C (and just about every other language), where things like int i[2] means that i has 2 elements, i[0] and i[1].
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #20 on: April 07, 2006, 04:24:49 AM »

Quote from: "axipher"
NO NO NO, his first mistake was DIMing I(2) and and thinking that gives I(0), I(1), and I(2), DIMing I(2) gives 2 values for I starting at index 0, same thing for P.  Now there's 2 solutions if you want to access I(0) to I(2):

Code:
DIM I(3) AS CAR
-OR-
Code:
DIM I(0 TO 2)


Both give the same results, but the second one can allow you to make the array start at index 1 and go to 3.


Wrong. That's in C. Dim I(3) gives you I(0), I(1), I(2) and I(3) in BASIC.

Dim I(2) is for indexes 0, 1 and 2.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Mac
Senior Member
**
Posts: 243


WWW
« Reply #21 on: April 07, 2006, 07:56:04 AM »

Quote from: "axipher"
Anonymous member of the No More Religion Threads movement


 :Huh:

What's that?

Mac
Logged
Z!re
*/-\*
*****
Posts: 4599


« Reply #22 on: April 07, 2006, 08:07:44 AM »

Quote from: "Mac"
Quote from: "axipher"
Anonymous member of the No More Religion Threads movement


 :Huh:

What's that?

Mac
Just what it says.. but pay no attention to the heathens.. join in praising me as your only and true divine saviour, or burn eternally in damnation.. tortured by fluffy bunny rabbits!
Logged
Pritchard
Wandering Guru
***
Posts: 328


« Reply #23 on: April 07, 2006, 09:13:53 AM »

Quote from: "God"
Just what it says.. but pay no attention to the heathens.. join in praising me as your only and true divine saviour, or burn eternally in damnation.. tortured by fluffy bunny rabbits!


Mhm. You don't want to mess with Z!re. Trust me. She's our Lord...I swear to God (Z!re), when YAGL came out she was all, "Here's a demo, here's another totally pwnz demo, and another"

We were all, "How did you do that so fast and so well!?"

She (God, Z!re) was all, "Lol...It's pretty easy when you're God. LOL!"
Logged

 will Live Forever, or Die Trying >_<;;
Pritchard
Wandering Guru
***
Posts: 328


« Reply #24 on: April 07, 2006, 09:15:16 AM »

Quote from: "God"
Just what it says.. but pay no attention to the heathens.. join in praising me as your only and true divine saviour, or burn eternally in damnation.. tortured by fluffy bunny rabbits!


Mhm. You don't want to mess with Z!re. Trust me. She's our Lord...I swear to God (Z!re), when YAGL came out she was all, "Here's a demo, here's another totally pwnz demo, and another"We were all, "How did you do that so fast and so well!?"She (God, Z!re) was all, "Lol...It's pretty easy when you're God. LOL!"

In Short: Z!re has the attitude to be a Goddess, but also a higher skill in programming than most of us, so there's not much we can do to stop her ^_^;; (not like any of us want to...Most are worshipping willingly)
Logged

 will Live Forever, or Die Trying >_<;;
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #25 on: April 07, 2006, 10:38:36 PM »

Z!re also shits and pees like you and me.

But she's great Smiley
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #26 on: April 09, 2006, 01:44:06 AM »

Thank you na_th_an, that is very generous of you.
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.
anarky
Been there, done that
*****
Posts: 1231


The Blobworld Comics King


« Reply #27 on: April 09, 2006, 09:55:00 AM »

To avoid the confusion, use the latter DIM technique:

Code:

DIM I(0 to 2)


Or whatever. Give it inclusive low and high boundaries.
Logged

Screwing with your reality since 1998.
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #28 on: April 10, 2006, 05:30:53 AM »

You just have to remember the DIM statement semantics:

Code:
DIM ([<min_element_index> TO] <max_element_index>)


<min_element_index> can be omitted (notice the square brackets), the default being what's defined in Option Base

Code:
OPTION BASE 0|1


which can be wether 0 or 1. If this directive is absent, the default is 0.

You just have to remember that: the numbre is a "max element index", not a "number of elements" like in C or Java.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Mac
Senior Member
**
Posts: 243


WWW
« Reply #29 on: April 10, 2006, 08:13:46 AM »

I used to always just code DIMs like
DIM S(100) as integer
even though I planned to only use (1 to 100).

Why? Because it was quick and easy and I didn't mind wasting S(0).

However, I've come to appreciate (1 to 100) more, and certainly not to save one measly cell.

The reason: a good protection against this bug:
y%=S(leest1)
when I meant
y%=S(least1)

My spelling error will, of course, go unnoticed by QBasic. I get the equivalent of y%=S(0).

If I use (100) or (0-100) then y%=S(0) has a legal value and thus I get y%=0 and have a hard time finding this bug.

If I use (1-100) y%=S(0) will fail immediately (OUT OF RANGE).

Mac
Logged
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!