• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with a lottery program assignment  RSS feed

 
micah wise
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK so newbie coder back again, thanks in advance! We are instructed to create a lottery program that has the user enter 3 seperate digits each from 1-10, so something like 567, 359, 777, etc. He wants a loop for the 3 and then have them connected. He then wants the computer to randomly pick 3 digits. Then after the user has input their digits he wants them compared to the computer. He wants to know if the 1st 2, the 2nd 2, all 3 or none are correct. I have been at this for about a day now and am no closer than at the start, but I have learned a few things and have some code to share and perhaps some awesome folks can get me off the ground!!!

As it stands at the moment I can get it to compile but it will only allow me to enter the 3 digits and then nothing else happens, arrr. Not really sure what to do or how to get the computer and user input to chat nicely and to compare let alone get it outputed to the screen



 
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
user enter 3 seperate digits each from 1-10

Technically 10 has two digits: 1 and 0

then nothing else happens

To test your if statements to see if they do what you want, comment out the use of random numbers for testing and replace them with hard coded numbers.  Then input values that will match 1, 2 or 3 for testing.

When the if statements have been tested and are working, restore the code to use random.


Also comment out the for loop for testing.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!