19行试了下avg=(int)(sum/n)*100/100还是错的想知道这样子应该怎么改,错在哪里了?
sum/n2个int相除,结果也是int,小数被丢弃。sum*1.0/n
int型除以int型还是int型,只需要在分子或分母乘以1.0即可