fred rosenberger wrote:I corrected your code tags to get it to display better.
[edit]apparently there was a minor bug in our release that cause the code tags to not work correctly.[\edit]
The first tip i have is to ask you to explain what "it runs but, but not correctly" means. What do you expect it to do, and what does it do? Why is that not what you expect? We have no way to know how to 'fix' the code to get it to do what you expect if we don't know what that is.
The easier you make it for someone to help you, the more likely you are to get that help.
Right now it's set up to create a random number between 100 and 999 I have it set up so that it shows what that number is so I can
test it, when i test the program it doesn't run correctly because let's say the number is 600, if I put in 600 it doesn't say the user has won, this
is supposed to make it do that. The other two wins are supposed to be triggered if the user's inputted number has the same first two numbers or last two numbers as the number randomly selected. Hope that explains that well enough if not I don't mind trying to explain it more specifically again. Thanks for the help, sorry for not being specific enough.
Paul Beckett wrote: think about your conditional logic. Hint: You have four conditions, the first two are "equal" and "not equal".
Not sure what you mean, my first condition (the for loop) runs the loops if the remaining tries the user has doesn't equal 5. and the second compares the number the user puts in to the random number, and then if it's not equal it prompts the user for a new guess(entry).
Sean Clark wrote: Oops, I see why you have used it, please ignore me.
Don't sweat it
, I appreciate you trying to help.
Lester Burnham wrote: You're using the "==" operator to compare strings - BIG no-no! You need to use the "equals" method instead.
I wasn't aware that the == couldn't be used for strings as well, i thought it was just used for anything within a boolean statement (if,for,while etc.), it's worked fine for me before but I don't think I was comparing strings then, thanks for the tip. I've changed that but I'm still getting the same results, it's only printing the first if statement that prompts the user for a new entry.