By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

lootery ball progam

P: n/a
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
Jul 22 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"carl bloc" <ca****@tesco.net> wrote in message
news:8c**************************@posting.google.c om...
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
Jul 22 '05 #2

P: n/a
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)
Jul 22 '05 #3

P: n/a
ca****@tesco.net (carl bloc) wrote in message news:<8c**************************@posting.google. com>...
[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.
Jul 22 '05 #4

P: n/a

"red floyd" <re********@yahoo.com> wrote in message
news:96************************@posting.google.com ...
ca****@tesco.net (carl bloc) wrote in message

news:<8c**************************@posting.google. com>...
[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
Jul 22 '05 #5

P: n/a
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
Jul 22 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.