Reputation: 26511
I've built console progress bar, it works just fine, but the problem is that on numbers with no decimals it does not print it. I need it to print 100,0
instead of 100
. Probably easy task, but I don't know how.
float percent = (float)(progress * 100) / total;
Console.Write(" [{0}] [{1}]", userID, Math.Round(percent, 1));
Upvotes: 2
Views: 134
Reputation: 171411
Console.Write(" [{0}] [{1}]", userID, Math.Round(percent, 1).ToString("N1"));
Upvotes: 0
Reputation: 6181
Try using " [{0}] [{1:0.0}]"
instead:
Console.Write(" [{0}] [{1:0.0}]", userID, Math.Round(percent, 1));
Upvotes: 3