I been trying to work this out for some time now and I just can not get my head around this everythink i do just does not work.
t= total seats
a = taken seats
int
t, a, avg;t = Convert::ToInt32(txtfirstclass->Text);
a = Convert::ToInt32(txtavfirstclass->Text);
avg = 100 -( (a*100) / t);
progressBar1->Value=avg;Say there are 25 taken and 50 total seats progressbar should be at 50%.
and if there are 10 seats and 1 is taken then progressbar should be at 10%.

Need Help with Maths with progressbar
Kenn Roland
blaflen
It looks like you're calculating the percentage of available seats, not the percentage of taken seats. The formula for calculating the taken seats is:
taken
------- * 100 .
total
My other suggestion would be to try calculating this in floating point arithmetic:
Pradeep K
After testing this myself, I see that floating arithmetic is not necessary. Integer arithmetic will do just fine. ie. the code: