How to compute win/loss percentage in Visual Basic
I found a win, loss, percentage calculator in the forums. The form has a PLACE FOR INPUT
Team Braves
WINS = 96
LOSS 66
a button Compute Percentage and a text box it should read Braves won 59.259 percent of games. The program in the forums does not work. Does any one know how 开发者_C百科to do this? The math should be wins / wins+loss * 100. Pleas HELP This is in V B
Aren't you forgetting the parentheses?
wins / (wins + losses) * 100
If you're looking specifically for that format of number, Double.ToString() can format that for you:
Textbox.Text = ((wins / (wins + losses)) * 100).ToString("#0.###")
精彩评论