### need help with basic c++ please

I was assigned an assignment that my professor did not teach us how to do at all, so can someone please help me out.
here are the instructions:

Write a program to test an elementary school student in division. Your program should generate a division problem using the random number generator. Your divisor and answer must both be integer values from 1 to 9 which are determined at random. Your program should

• prompt the user for his/her name
• prompt the user for a response to your randomly generated problem
• issue a message either congratulating the user or issuing condolences
along with the correct answer
Out of the things you are asked to do, what can you do? What knowledge do you have? Have you tried to make it at all... it is better to do what you know first and build up on it, also break the program down into small parts to make it easier.
try it yourself first. write it. If it does not work then bring it here. It take half an hour to write thatprogram. Google it. You will find a lot of stuff :)
i honestly have no idea how to do it. if someone could at least push me to the right direction. anything would be a great help
Well first off, your obviously going to have to use a loop. - Decide which one.
Work the program out without the random number generator first - that would seem easier to me first.

You will need a loop for data validation and another for the correct response: heres a code I had for a previous assignment that might help.

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152`` ``````/* Math Game! 1 * 2 = users input 2 *1... all the way through 10 */ #include using namespace std; int main () { int secondNumber, inputNumber, result, firstNumber = 1; int right = 0, wrong = 0; for(firstNumber = 1; firstNumber <=10; firstNumber++) { for(secondNumber = 2; secondNumber <= 10; secondNumber++) { do { cout << firstNumber << " * " << secondNumber << " = "; cin >> inputNumber; result= firstNumber * secondNumber; if(inputNumber == result) { cout << "Correct!!\n"; //right++; } else { cout << "Try again!\n"; // wrong++; //secoundNumber--; can use this instead of the do while loop } } while(inputNumber != result); } } //cout << "Right: " << right << "\nWrong:" << wrong <

Thats a code for just a simple math game, but the concepts in it can def help you with this program!
Thanks! I appreciate this a lot!
Topic archived. No new replies allowed.