Result == 't';
This is a comparison operation. You're checking if the value in
Result
is equal to
't'
. So in your rps function, you are not actually changing the value of
Result
at all. It is still whatever garbage value it was when the program was started (since the variable wasn't initialized).
1 2 3 4 5 6
|
if (Game_Result == 'w')
Win_Count++;
else if (Game_Result == 'l')
Loss_Count++;
else if (Game_Result == 't')
Tie_Count++;
|
Here you try to check the value of
Game_Result
. But as I said, it's a garbage value, very unlikely to be any one of 'w', 'l', or 't'. So in all probability, Win_Count, Loss_Count, and Tie_Count all stay at 0.
double Perc_Wins = (Wins / (Wins + Losses + Ties) * 100);
Here you try to do math with those values. You are trying to compute
0 / (0 + 0 + 0) * 100
. The program crashes since you are trying to divide by 0.