Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

Question Array + Function + GOD BLESS AMERICA

$
0
0
Hello all!
I am currently trying to write a program for my class.

The program's purpose is to find standard deviation of a group of numbers.

I managed to write the whole the program without using any functions but the instructor wants to see function in this program. This is where I need help.

Here is my program.
Quote:



Dim a,sum,sserror,fvar,dSD As Decimal
Integer.Tryparse(Inputbox("Enter number"),a)
a = int(Rnd()*100)

Dim array(a-1) As Integer

For i=0 to a-1
array(i) = 5
Next

For j=0 to a-1
sum = sum + array(j)
Next

avg= sum/a

For k=0 to a-1
sserror = sserror + (array(k) - avg)*2
Next

dVar= sse / a 'calculates variance
dSD = dVar / 2 ' calculates st.deviation



The whole calculation code should be done in function part of the program and it should just call the function to textbox.
The output is the standard deviation of random numbers. It should be shown in textbox1.text

Instructor wants us to make this output by using the code textbox1.text = stdevFUNCTION(array)

I really appreciate any help

MAY THE FORCE BE WITH YOU

EVEN IF YOU DON'T LIKE STAR WARS

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>