开发者

How to compute win/loss percentage in Visual Basic

开发者 https://www.devze.com 2023-02-01 16:46 出处:网络
I found a win, loss, percentage calculator in the forums. The form has a PLACE FOR INPUT Team Braves WINS = 96

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.###")
0

精彩评论

暂无评论...
验证码 换一张
取 消