Results 1 to 13 of 13

Thread: Question Array + Function + GOD BLESS AMERICA

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2013
    Posts
    27

    Question Question Array + Function + GOD BLESS AMERICA

    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.


    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
    Last edited by sosarya; May 21st, 2013 at 12:43 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width