Thread: help with a lottery problem.

  1. #16
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> yes i do i have that in the part for the 100 i think?
    You do, but that's not the problem I'm talking about here. Focusing on the $1000 part, the code I quoted is not correct. The ||s and &&s don't match the ORs and ANDs from the written English version of the logic you posted in post #13. See if you can see where and make it match.

  2. #17
    Registered User todouble22's Avatar
    Join Date
    Jan 2010
    Posts
    13
    Quote Originally Posted by Daved View Post
    >> yes i do i have that in the part for the 100 i think?
    You do, but that's not the problem I'm talking about here. Focusing on the $1000 part, the code I quoted is not correct. The ||s and &&s don't match the ORs and ANDs from the written English version of the logic you posted in post #13. See if you can see where and make it match.
    OKAY FOR THE 1000
    Code:
     
    if (firstGuess == firstResult || firstGuess == secondResult || firstGuess == thirdResult 
    	&& secondGuess == firstResult || secondGuess == secondResult || secondGuess == thirdResult
    	&& thirdGuess == firstResult || thirdGuess == secondResult || thirdGuess == thirdResult)
    	cout << "You win $1,000 " << endl;

  3. #18
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Nice. Does it work? The only thing you might need to add are parentheses around each group of || checks to separate them from the &&s.

    After that, try the written english for the $100 win.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. Array Problem
    By Raekwon1 in forum C Programming
    Replies: 2
    Last Post: 04-13-2007, 04:59 PM