lootery ball progam

Discussion in 'C++' started by carl bloc, May 26, 2004.

  1. carl bloc

    carl bloc Guest

    Has any body got any code for this brief that a friend has to do, its
    for the uk version of the lottery i.e 6 balls and a bouns ball.

    1. a control loop is required to determine the operation required by
    the user
    2. use of a switch structure to execute required operation
    3. read old draw data from file into arrays on programme start up
    4. allow the user to enter the latest data
    5. allow the user to modify existing draw data
    6. view draw data for a selected week given the date of the draw or
    week number
    7. save the draw dta from arrays to the file on programme exit
    8. the programme must validate that the ball numbers input are in the
    correct range (between 1 and 49) and no duplicates.


    Thanks
    carl bloc, May 26, 2004
    #1
    1. Advertising

  2. "carl bloc" <> wrote in message
    news:...
    > Has any body got any code for this brief that a friend has to do, its
    > for the uk version of the lottery i.e 6 balls and a bouns ball.
    >
    > 1. a control loop is required to determine the operation required by
    > the user
    > 2. use of a switch structure to execute required operation
    > 3. read old draw data from file into arrays on programme start up
    > 4. allow the user to enter the latest data
    > 5. allow the user to modify existing draw data
    > 6. view draw data for a selected week given the date of the draw or
    > week number
    > 7. save the draw dta from arrays to the file on programme exit
    > 8. the programme must validate that the ball numbers input are in the
    > correct range (between 1 and 49) and no duplicates.
    >


    Show the code that you have already written, and someone will be able to
    help you with it (assuming you can frame a coherent question, something that
    some posters seem to have trouble with). We don't do you homework for you.

    john
    John Harrison, May 26, 2004
    #2
    1. Advertising

  3. carl bloc

    osmium Guest

    carl bloc writes:

    > Has any body got any code for this brief that a friend has to do, its
    > for the uk version of the lottery i.e 6 balls and a bouns ball.
    >
    > 1. a control loop is required to determine the operation required by
    > the user
    > 2. use of a switch structure to execute required operation
    > 3. read old draw data from file into arrays on programme start up
    > 4. allow the user to enter the latest data
    > 5. allow the user to modify existing draw data
    > 6. view draw data for a selected week given the date of the draw or
    > week number
    > 7. save the draw dta from arrays to the file on programme exit
    > 8. the programme must validate that the ball numbers input are in the
    > correct range (between 1 and 49) and no duplicates.


    That sounds like a very specialized program written for only one user, the
    manager of the UK lottery. Also it seems to work for only one year, which
    bothers me because of the "seam" problem, in other words it would have to be
    a _running_ year. The suggestions below generalize the problem to work for
    several years. In view of the specialized nature it seems unlikely that
    anyone has such a brief lying around. I suggest your friend start by giving
    some tentative data definitions. I note that you have posted a similar
    question to comp.lang.c and the solution there might be quite different.
    Your friend should start by enquiring of the British Government if they will
    accept a solution in either language.

    He might think about a data structure along these lines.

    #include <time>

    struct Draw
    {
    int ball[6]; // 1..49
    int bonus; // 1..49 ??
    time_t date_stamp; // probably will be a long. FYI only
    };

    The file would consist of several of these Draw records. As such it (the
    file) would be an archive if you ignore the quibble that some person is
    entitled to modify the archive according to his whim..

    Modify as necessary and start writing some code, simplest thing first. If
    you can't decide what is simplest toss a coin eight times. If after several
    minutes you wish the coin toss had come out differently, toss the coins
    again and have another go.

    That is working towards a C oriented solution but using C++ syntax.

    Compile often. Actually link and run frequently - but less often.

    It sounds like fun, tell him to get started. (I assume it is a he)
    osmium, May 26, 2004
    #3
  4. carl bloc

    red floyd Guest

    (carl bloc) wrote in message news:<>...
    > [blatant homework request redacted]


    You know, these guys make it easy for us to ID homework. If they
    said, "I want help with a lottery program", then maybe it's OK. But
    when it says *HOW* to implement, that's clearly homework.

    Any requirement specification tells says what to do. The details of
    the implementation are undefined. When you start saying, "I want to
    do X, and it has to be done by A, B, and C", then you know you are
    dealing with homework.
    red floyd, May 26, 2004
    #4
  5. "red floyd" <> wrote in message
    news:...
    > (carl bloc) wrote in message

    news:<>...
    > > [blatant homework request redacted]

    >
    > You know, these guys make it easy for us to ID homework. If they
    > said, "I want help with a lottery program", then maybe it's OK. But
    > when it says *HOW* to implement, that's clearly homework.
    >
    > Any requirement specification tells says what to do. The details of
    > the implementation are undefined. When you start saying, "I want to
    > do X, and it has to be done by A, B, and C", then you know you are
    > dealing with homework.


    I don't mind helping with homework at all. Its when the request is 'do my
    homework for me' that I object.

    john
    John Harrison, May 26, 2004
    #5
  6. carl bloc

    Default User Guest

    John Harrison wrote:

    > I don't mind helping with homework at all. Its when the request is 'do my
    > homework for me' that I object.



    The same message was posted over on comp.lang.c, so the googer doesn't
    even know what language the problem should be done in.




    Brian Rodenborn
    Default User, May 26, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Buck Rogers

    Help with a progam

    Buck Rogers, Jan 21, 2004, in forum: C Programming
    Replies:
    13
    Views:
    740
    Dave Thompson
    Feb 2, 2004
  2. vj

    Progam not running

    vj, Apr 17, 2007, in forum: C++
    Replies:
    17
    Views:
    573
    Sam of California
    May 17, 2007
  3. vj

    Progam not running

    vj, Apr 17, 2007, in forum: C Programming
    Replies:
    15
    Views:
    511
    Sam of California
    May 17, 2007
  4. fabien.lyon
    Replies:
    0
    Views:
    245
    fabien.lyon
    May 29, 2007
  5. AJ
    Replies:
    6
    Views:
    1,379
    Joe Greer
    Dec 4, 2009
Loading...

Share This Page