this may seem stupid, but i wanted to understand a few equations ive incountered.

given these declarations of a two dimensional integer

Dim table As Integer(,) = New Integer(2,4)

Dim intA as integer = 1
Dim intB as integer = 4

figure out the value of int x:

int x= table(intB,intA)
int x = table(2*intA, intB-intA)
intx = table(2, table(intA +1,intB - 1))
intx = table(intA,table(intA,intA))
intx = table(table.getupperbound(0),table.getupperbound(1))

im just trying to figure out how to solve this equation. Thanks.
PS- no this isnt a joke, im curious. thanks.

Edited by __avd: Added [code]..[/code] tags.

5 Years
Discussion Span
Last Post by Tarkenfire

That is not an equation to solve. There is no equation. The solution based on this is intx. What are you trying to do?


The equals sign in VB is the same as an equals sign in math most of the time. It can be used to test equivalence, but cannot be used to solve a mathematical equation. (well, at least in the sense you're thinking.)

The program you have there does nothing but assign undeclared variables to the result of a call to a method called table, which doesn't ring any bells to any methods I know off the top of my head.

Can you explain in more detail what you want to know?

Edited by Tarkenfire: n/a


thanks guys,
What i was trying to do is solve the value of 'int x',based on the arrays that were given.I decided to just write out the problems in microsoft studio and out put the result with a label.

Label1.Text = table(2 * A, B - A)

If you check the third list of elements you would find the answer to this equation would ouput the number 5.
I hope that makes sense. If not u guys can try it out to give ur self a better understanding of what im talking about.
Thanks again guys.


Okay, it's clearer now. Well, there doesn't look to be anything wrong with the syntax of any of those statements SO LONG, as the answers to the two values in the table array don't exceed the bounds of the array.


Sorry for double post, but I noted next to the equations what would happen to each of these.

intx= table(intB,intA) - Will throw an exception as 4, 2 is not in the range of the array
intx = table(2*intA, intB-intA) - Should work
intx = table(2, table(intA +1,intB - 1)) - Should work
intx = table(intA,table(intA,intA)) - Should work
intx = table(table.getupperbound(0),table.getupperbound(1)) - have to look into this more
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.