Please Help Me

This is a discussion on Please Help Me within the C Programming forums, part of the General Programming Boards category; I have to create a program that generates 100 random numbers between 0 and 99,999 and store the numbers in ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    2

    Unhappy Please Help Me

    I have to create a program that generates 100 random numbers between 0 and 99,999 and store the numbers in a 10 by 10 table. Then calculate the mean, varience, and standard deviation of all the numbers.

    Please help me. I'm so confused.

    Thank you

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    First off, you need to create a program that generates 100 random numbers, between 0 and 99999, and stores them in a 10x10 grid... oh wait, that's what you just said.

    Come on people ! At least _TRY_ your homework first!

    Quzah.

  3. #3
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    523
    You must have have done something, surely?
    I don't think yout tutor would set you homework about a topic you havent covered.
    All spelling mistakes, syntatical errors and stupid comments are intentional.

  4. #4
    Unregistered
    Guest

    Angry

    Use randomize()

    deviation and variance definitions; look them up.

  5. #5
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Code:
    #include<stdlib.h>
    #include<time.h>
    #define read_the_faq_ for(i=0;i<10;i++)
    #define now_would_it return 0;}
    #define you_lazy_slob_ long a[10][10];
    #define unregistered {srand((unsigned)time(0));
    #define you_could_have_ for(j=0;j<10;j++)
    #define it_wouldnt_have_hurt_ {l=rand()%100000;a[j][i]=l;}
    #define do_your_ int i,j;
    #define own_work_ long l;
    
    
    int main()
    unregistered
    do_your_own_work_you_lazy_slob_you_could_have_read_the_faq_it_wouldnt_have_hurt_now_would_it
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    36
    The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. Use the srand function to seed the pseudorandom-number generator before calling rand.

    BTW: in vc's library,RAND_MAX=32767, and in the GNU library, it is 037777777.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21