Why is this Adding, when i Clearly have a "-"?

  • first of all when you are subtracting two int values you do not need to cast the result to an int since it already is an int value. So get rid of the "(int)".


    then your GetAmount value is the content of player 1's wallet, but you are using that to set the final amount on the wallets of both players. That makes no sense, you should get the amount of each player's wallet (i.e. GetAmountP1, GetAmountP2) and then add to the one, subtract from the other (i.e. int TotalP1 = GetAmountP1 - GiveAmount, and int TotalP2 = GetAmountP2 + GiveAmount)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!