求助!关于pow函数的强制类型转换
#include<iostream>
#include<math.h>
using namespace std;
int main(void){
int n;
while(1){
cin>>n;
cout<<pow(10,n)<<" "<<(int)pow(10,n)<<endl;
}
return 0;
}
运行程序,输入2,得到输出100 99
很奇怪为什么用pow(float x,float y)求x的y次方,结果强制转换为整型后会少1???
注:环境是dev c++