int类型转double的心得
int n1 = 5;
int n2 = 2;
double ans;
若ans = n1/n2;
则ans = 2.00;
若ans = (double)(n1/n2);
则ans = 2.00;
若ans = (double)n1/n2;
则ans = 2.5;
若ans = (double)n1/(double)n2;
则ans = 2.5;
来源:CSDN
作者:直男straight
链接:https://blog.csdn.net/weixin_44783556/article/details/104428569