Question on help writing math formula tia sal

S

sal

Greets All,

I'm having a little trouble in creating dynamic arrays I've had some help
in getting this formula but I'm not sure how to make the array dynamic
enough in vb.net to include Cn.....Xn in example 1.

Example 1:
User Input for four numbers 15,17,8,12, (Note: user can input any amount
of numbers)

(15+17) /25/2 ->b1
(b1+8) /25/2 ->b2
(b2+12) /25/2 ->b3
(b1+b2) /25/2 ->c1
(c1 +b3)/25/2 ->c2
(c1 +c2) /25/2 ->c3



What I have so far not finished though having problems.

Store user input in array [a0,...,aN]
Create new array [b0,...,bN]

a[0]-->b[0]

for k=1 to N {
b[k]<--((a[k]+b[k-1])/25)/2
}



TIA
 
P

PresterJohn

Use ReDim Preserve as required to dynamically expand the array.

To create a copy of an existing array use the clone method, for example: Dim
newArray() as Integer = oldArray.Clone.

BTW, this is trivial if you use an ArrayList instead of an array...


Prester John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top