Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Location
    London
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pseudocode need HELP?

    Hi,

    Can anyone help me create an array code that generates 50 random numbers.

    thanx.

    so far i done this but its not working.

    arrayName= new ArrayType [sizeOfArray];
    sizeOfArray = 50;
    double [] numbers = {9,1,3,10,10,5,6,50,45,39,1,2,3,5,10,11,13,29,20,21,21,21,10,40,9,15,27,27,30,29,4,49,50,50,13,14,15 ,1,2,2,2,2,2,7,3,14,4,5,6,7};

  • #2
    Regular Coder dswimboy's Avatar
    Join Date
    Nov 2003
    Location
    mostly in Ann Arbor
    Posts
    458
    Thanks
    0
    Thanked 0 Times in 0 Posts
    not sure what language you're using, but the only real difference between each language will be variable declaration and random number generation.
    the for loop is the key here though.

    Code:
    int total_rands = 50;
    Array random = new Array[total_rands];
    for (int i=0; i<total_rands; i++) {
         random[i] = random_number_var;
    }
    "There is more than one way to do it."


  •  

    Posting Permissions

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