Thread: Random numbers

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    5
    Rep Power
    0

    Random numbers


    hi,

    1. we would like to know how to generate a random number from 0 to 9 using C ( C free 4.0 software)
    2. also we would like to know how to display that number on the full screen( eg: the number 2 should be displayed with font size of 90 on a new window)


    please help

    ashwini....
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2009
    Posts
    45
    Rep Power
    8
    1.
    Code:
    #include <stdlib.h>
    #include <time.h>
    
    void initRandom(void)
    {
        srand(time(NULL));
    }
    
    int generateRandom(void)
    {
        return rand() % 10;
    }
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    5
    Rep Power
    0
    thank you.. :)
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    5
    Rep Power
    0

    random number generator


    hey,

    we used the code that u provided us with and we are getting the error- linker error : undefined symbol main in module.

    please provide us with another code


    thanking you
    ashwini...
  8. #5
  9. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    How about you learn to code in C first?
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo