completely stumped

Our teacher assigned this problem:

2. Multiplication Teacher: Some elementary school students say that they find computers just as easy to learn from as teachers. Write a simple C++ program that helps kids practice the multiplication tables by giving them two random one-digit integers and asking them to multiply them together in their head and type their answer. Your program will test their answers one at a time, and report each one correct/incorrect. Example run:



Welcome to the multiplication machine.

What’s 6 x 8? 48

Correct! Try another (y/n)? y

What’s 3 x 9? 14

No. Please try again.

What’s 3 x 9? 27

Correct! Try another (y/n)? n

Bye!



If student enters an incorrect answer, keep offering additional chances at the SAME digit pairs until they’re able to get it right. Show your output for at least 2 students, with at least 6 random digit pairs each, with demonstrations of a few incorrect responses. Remember, the digit pairs to be multiplied are to look random between 1 and 9.

And I have no idea how to approach it. I don't think we have even covered this material any help would be greatly appreciated.
Try: http://lmgtfy.com/?q=c%2B%2B+random

Hope that helps...
You really should attempt the code before posting to forums. Figure out how to generate random numbers, rjcup has already helped you out there. Output the 2 random numbers, read in an input from the user, compare this input to the answer when the two numbers are multiplied together. If the answer is wrong have it loop back to ask the user to try again. Have pretty much the whole thing in one big while loop, that exists if the user says they don't want to try another.

If you can't understand any of that work your way through these and get back to us.

http://www.cplusplus.com/doc/tutorial/
Topic archived. No new replies allowed.