我试图运行这个,并且似乎无法找出为什么它不会运行。先谢谢你。请知道我是新人。当使用电源功能时,float和int的比较
#include <stdio.h>
#include <math.h>
int main(void)
{
float IR;
float invested;
float time;
printf("Please enter the following to be calculated:");
scanf("Interest rate: %f\n", &IR);
scanf("Amount invested: %f\n", &invested);
scanf("Time: %f\n", &time);
float ans;
ans = (invested(((float)1+((IR)^(time)))));
printf("%f", ans);
}
'投资'是什么变量或功能? –
如果浮动变量投资。 – Mukul215
要对一个浮点值进行硬编码,只需在'.'后面加上文字,就不需要再进行投射。 '1'是一个整数文字,'1'是一个浮点文字。 – alk