When you call the
rand
function, it returns a single random number: it doesn't make the variable you assign that to change it's value every time you use it.
Unfortunately, your code is so corrupt that I can't work out what exactly you typed: I can't get anything that will compile out of that.
But ... if you want two random numbers, you need to call
rand
twice:
num1 = rand();
num2 = rand();
Secondly, the numbers are (pseudo) random: that can be any value in the range 0 to RAND_MAX (which in practice will be a minimum of 32,767) so to get a specific range you need to use the Modulus operator on both returned values, not just one.
Thirdly, if you want numbers between 0 and 99 inclusive, you need to use
x % (upperValue + 1)
: if you sue
x % 99
the values will be between 0 and 98 inclusive, not 0 and 99!
See here:
Modulo Operator (%) in C/C++ with Examples - GeeksforGeeks[
^]