lootery ball progam

C

carl bloc

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
 
J

John Harrison

carl bloc said:
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
 
O

osmium

carl said:
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)
 
R

red floyd

[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.
 
J

John Harrison

red floyd said:
(e-mail address removed) (carl bloc) wrote in message
[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
 
D

Default User

John said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top