- #1
magnifik
- 360
- 0
can someone tell me what is wrong with my code? i am trying to make a code that has 1000000 randomly choosing A or B 1000 times. if A is bigger than B, i want to increment the variable called 'aWins'... when i try to get it to print the screen is blank. i left out the int main and #include parts but i have them in my real code...
Code:
for (int j = 0; j < 1000; j++){
for (int i = 0; i < 1000000; i++){
srand(time(0));
if ((rand()%2) == 0)
A++;
else
B++;
}
if (aWins(A,B))
aWins++;
}
cout << aWins << endl;
// this is my aWins function
bool aWins(int x, int y){
if (x > y)
return true;
else
return false;
}