Can't find the problem

This code is part of my homework and its almost done, but the problem with the code is that no matter what if the user get only 9 or less out
Last edited on
integer division returns an integer.
return ((double)rq / tq) * 100;


By the way, double AverageGiver(int tq, int rq, double x)
The value of `x' is irrelevant to the function, ¿why is it a parameter, then?
Line 28: You call randNumGen(), but you ignore the returned product.
You probably want this statement inside your loop, otherwise you're going to be getting the same product every time.

Line 34: First time through the loop, num1 and num2 are 0.

Line 37: you're comparing useranswer against the local variable product which was initialized to 0.

Line 47: Your call to srand() is in the wrong place. srand() should be called at the beginning of main, BEFORE you generate any random numbers, othwerwise you're going to get the same sequence of random numbers every time.

Lines 48-50: Why are you repeating code here that you have in randNumGen()?

Line 119: Why are you passing a and b as arguments, when you don't use the arguments? If you want a and b to be passed back to the caller, then you need to pass them by reference.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
http://v2.cplusplus.com/articles/jEywvCM9/
It makes it easier to read your code and it also makes it easier to respond to your post.
Hint: You can edit your previous post, highlight your code and press the <> formatting button.

Thank you guys so much! You guys are my heros you solved my problems in such short time.
bless you!
Topic archived. No new replies allowed.