Welcome Guest
Log In | Register )
You last visited January 17, 2017, 10:48 pm
All times shown are
Eastern Time (GMT-5:00)

Lottery Number Programming

Topic closed. 21 replies. Last post 9 years ago by RJOh.

Page 2 of 2
PrintE-mailLink
RJOh's avatar - chipmunk
mid-Ohio
United States
Member #9
March 24, 2001
19895 Posts
Online
Posted: January 25, 2008, 5:42 pm - IP Logged

can anyone can show me a sample of coding that will group let's say 5 numbers  combination together , ( c++ , visual basic , visual c++ etc ) thx , i'll be waiting for any replies thx once again . 

A simple loop to pick 5 random numbers between 1 and the largest number in the pool will product a combination of five regardless of the language you're using.  However if you want to check the combination for odd and even numbers and other conditions, you're going to need a more involved routine.  First you need to define all the parameters that the combination must meet to be acceptable such as the number of odd and even numbers, the total sum, the number of times it has matched previous winners and etc.

 * you don't need to buy more tickets, just buy a winning ticket * 
   
             Evil Looking       

    time*treat's avatar - radar

    United States
    Member #13130
    March 30, 2005
    2171 Posts
    Offline
    Posted: January 30, 2008, 5:52 am - IP Logged

    can anyone can show me a sample of coding that will group let's say 5 numbers  combination together , ( c++ , visual basic , visual c++ etc ) thx , i'll be waiting for any replies thx once again . 

    Between the math & pick5 forums, there are a few examples of such code. You can also search for the word 'loop'

    In neo-conned Amerika, bank robs you.
    Alcohol, Tobacco, and Firearms should be the name of a convenience store, not a govnoment agency.


      United States
      Member #7962
      October 19, 2004
      27 Posts
      Offline
      Posted: February 7, 2008, 1:20 am - IP Logged

      You could also do that with just Javascript or a combination of Javascript and HTML. Plus you'd get the added benefit of it running in any browser.


        United States
        Member #7962
        October 19, 2004
        27 Posts
        Offline
        Posted: February 7, 2008, 1:38 am - IP Logged

        Programming languages have a built in MOD function. Mod returns the remainder when dividing two numbers. Simply divide the number by 2 and if the result (MOD) is zero the number is even,  otherwise it's odd.

          RJOh's avatar - chipmunk
          mid-Ohio
          United States
          Member #9
          March 24, 2001
          19895 Posts
          Online
          Posted: February 7, 2008, 11:07 am - IP Logged

          Programming languages have a built in MOD function. Mod returns the remainder when dividing two numbers. Simply divide the number by 2 and if the result (MOD) is zero the number is even,  otherwise it's odd.

          For those languages that don't have the MOD function, you can use the ABS function (absolute value). If the number divided by 2 is the same as the ABS of the number divided by 2 then it is even. 

          Some time, languages with similar names don't have the same functions, for example Liberty Basic doesn't have "INKEY$" which all basics by Microsoft have, so when trying to covert MS Basic program to Liberty Basic similar routines have to be written differently.

           * you don't need to buy more tickets, just buy a winning ticket * 
             
                       Evil Looking       

            sfilippo's avatar - skull
            Oklahoma
            United States
            Member #33770
            February 24, 2006
            3146 Posts
            Offline
            Posted: February 7, 2008, 6:48 pm - IP Logged

            For those languages that don't have the MOD function, you can use the ABS function (absolute value). If the number divided by 2 is the same as the ABS of the number divided by 2 then it is even. 

            Some time, languages with similar names don't have the same functions, for example Liberty Basic doesn't have "INKEY$" which all basics by Microsoft have, so when trying to covert MS Basic program to Liberty Basic similar routines have to be written differently.

            LB has Inkey$

            Smiley Steve

              RJOh's avatar - chipmunk
              mid-Ohio
              United States
              Member #9
              March 24, 2001
              19895 Posts
              Online
              Posted: February 11, 2008, 11:26 pm - IP Logged

              LB has Inkey$

              I'll have to re-evaluate LB.  I tried the trial version and tried to convert some of my GWBasic programs to LB since it looked like it might be easier to learn than Visual Basic when I used the tutorial that came with it.  I used a lot of "inkey$" statements rather than "input" when only one character is needed in my programs  and couldn't find "inkey$" in the LB command list.

               * you don't need to buy more tickets, just buy a winning ticket * 
                 
                           Evil Looking