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;
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;