So i posted a question earlier to this problem. I had to write a program that randomly chooses two positive one-digit integers for a way to help students practice multiplication. I rewrote the code and everything works now. My problem is, how do I make the multiplication problem repeat itself if the student gets it wrong?
Your first answer was better. When you write functions your goal should be to limit what they do to a specific task. In your first response, correct_response and incorrect_response were responsible only for printing a response. They didn't have to do any sort of logic about asking questions and getting answers.
Look back at your original post. You're going to want to take lines 20 through 31 and wrap them in some kind of loop. do-while could work, see what you can come up with.
Thats why I did the do-while at the end in my second post. I keep getting the same thing when I change the code. It lets me enter a answer, if I am wrong it gives me the answer and ask if i want to play again. I want it to tell me to answer again in one of the responses instead of giving me the answer. I don't know how to change it to work . I keep trying and it gives me the same thing over and over again
So i changed it back and added things to the correct_response and incorrect_response and it gives me this when I compile it:
it ask how much is "" . I put in a wrong answer. It told me wrong, try once more and then I can't try it again, it says do you want to play again, i press 1 and it gives me a different problem.
Here is the code I have right now. When I compile it. It ask "How much is ""?" I put in a wrong answer, it says "No, please try again." Then ask do you want to play again. I hit 1 for yes. Then it ask the same problem again. I put in the cprrect answer. It says nice work. do you want to play again. then it says same problem again. So something is backwards somewhere. lol
Basically when i put in the correct answer it and ask to play again it gives me the same problem. when i put in a wrong answer it says wrong and then gives me a different answer and my code above was wrong.
Glad it's working you should remove your comment on line 15 or correct it :P It looks like you had != then changed it too == when you got rid of line 23 and forgot to fix the comment.