I would replace these lines:
x=rand()%100/2;
y=rand()%50/2;
righttotal=(x/y);
With:
1 2 3 4 5 6 7 8
while (true)
{
x=rand()%100; // Random number between 0 and 99
y=rand()%99 + 1; // Random number between 1 and 99 (not 0).
righttotal = x/y;
if ((x%y==0) && (y<x)) //Unless we have a quotient without a remainder and y < x, do it again.
break;
}
The problem you highlighted: while(righttotal!=righttotal%0)
(Number % 0) is rather strange. Essentially you are asking if a number is equal to the remainder of the same number once it has been divided by 0. You should also consider that you performed integer division, meaning that if you divide two integers in c++ (or c), the result will also be an integer (no remainder) so this really doesn't make sense.
I think you are looking for x%y==0 which means that x/y has no remainder.