yes, a = a - rand5()*rand5(); is allowed in C++
and values are returned simply by:
Code:
return name_of_variable;


now, in your while loop 'a' doesn't actually get changed, so making "b = a" at the end is just going to make "b = whatever 'a' was at the beginning". and since 'a' doesn't change, if the condition was true (which it won't be, as i explain later), it would be an infinite loop.

also, you don't need to have "int" in front of each reference; in fact you aren't allowed, because then it tries to declare another integer of the same name. basically what i mean is that last line should be "b = a;", not "int b = a;".

another thing is the "7<a<1" -- that means "seven is less than 'a' which is less than one", but since 7>1, that will never be true.

additionally, i don't actually know if C++ would handle a two-part comparison like that. i think i would normally do "((1<a)&&(a<7))", but "(1<a<7)" might work. i've just never tried.

and lastly, rand5()*rand5() won't deal with every number between 1 and 25, because some are primes (7, 11, 13, 17, 19, 23), and some just won't be reached by multiplying two numbers between 1-5, even if they aren't primes (such as 18 and 24). the numbers that you DO get have unequal probability; for example, you can only obtain a 25 by getting 5*5, but you can obtain 4 by getting 1*4, 4*1, and 2*2.

and before i go, don't take this the wrong way, like i'm picking apart your code. i know you said:
Quote:

I'm new to programming (and I've been doing Java which is slightly different)


good onya for making an attempt anyway

julz


Formerly known as JulzMighty.
I made KarBOOM!