CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: GCDEF

Search: Search took 0.75 seconds.

  1. Replies
    8
    Views
    3,112

    Re: Generating lottery numbers

    I'd make the outer loop a while loop instead of a for loop, keep track of how many numbers you've added to the output array and keep looping till that number = 5. Generate the random number. Use...
  2. Replies
    8
    Views
    3,112

    Re: Generating lottery numbers

    The way you use SIZE in your code would be regarded as bad technique. I doubt when the instructor said don't use global variables they meant don't use a const int like that. An alternative would be...
  3. Replies
    8
    Views
    3,112

    Re: Generating lottery numbers

    Two points.

    const int SIZE = 5;
    should be declared outside a function and used anywhere you need to know the size of the array. You declare the array in main using the number 5, then specify...
Results 1 to 3 of 3





Click Here to Expand Forum to Full Width

Featured