|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
#include <math.h>
int main()
{
float p,r,n;
r = 0.07;
n = 10;
p = pow(1+r,n);
printf("%p = %f\n",p);
return 0;
}
CTRL+F5后无error,但是显示的答案有误,怎么解决。应该输出的是p = 1.967151 调试结果显示是B515F7B2 = 0.000000
Press any key to continue
--------------------Configuration: 044 - Win32 Debug--------------------
Compiling...
044.c
E:\c++\Microsoft Visual Studio\MyProjects\044\044.c(7) : warning C4305: '=' : truncation from 'const double ' to 'float '
E:\c++\Microsoft Visual Studio\MyProjects\044\044.c(9) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
044.obj - 0 error(s), 0 warning(s)
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- float p, r, n;
- r = 0.07;
- n = 10;
- p = pow(1 + r, n);
- printf("p = %f\n", p);
- return 0;
- }
复制代码
|
|