Hi every one, i have been given an assignment, and i need your help in making the programme. The question is

Write a program to simulate a lottery game where a set of the lottery numbers includes 6 different numbers from 1 to 49. A possible run may look e like:

Enter your lottery numbers: 3 10 18 23 37 41
The winning numbers randomly selected by the computer are: 3 12 18 27 37 49
You won 3 stars: 3 18 37
Enter your lottery numbers: 5 7 18 23 32 44
The winning numbers randomly selected by the computer are: 6 12 17 29 38 47
Your lottery numbers don't match any number. Thanks for playing the lottery game.

Recommended Answers

All 5 Replies

  • choose 6 numbers and it must not be repeated.
  • Random a number for 6 times and the Random number must not repeat.
  • match the choosen number and the random numbers.
  • count if the choosen number is match to random numbers.

God Bless and happy programming.

Actually i am new to programming and i am really weak in basics, and what method do we use to match de numbers?

that would depend on the datatype. especially when you are weak, you should try yourself, by just asking someone to do it for you, you won't learn anything.

what have you got so far?

all of us start at the very beginning but to must strive to be the best. programming world is too huge, but we are willing to help you, if you want to improve.

I know you can do it, like what we are now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.