求大神看看我的程序哪边有问题啊!题目是:若1982年人口为10.3亿,当我国人口增长率分别为3%,2.5%,2%,

2025-01-18 13:38:58
推荐回答(3个)
回答1:

这样就可以了:
#include
#include
void main() {
int year=1982,i;float rk=10.3,k=1.0,a[5]={0.03,0.025,0.02,0.01,0.005};
for(i=0;i<5;i++)
{ do{ rk=10.3*pow((1.0+a[i]),k); k=k+1.0; year++;
}while(rk<14.0);
printf("在%f的增长率下,从1982年起,未来在%d年人口会超过14亿\n",a[i],year);
rk=10.3; k=1; year=1982;
}
}

回答2:

do{ rk=rk+10.3*pow((1.0+a[i]),k); k=k+1.0; year++;
}while(rk<14.0);
改为
do{ rk=rk+10.3(1.0+a[i]); year++;
}while(rk<14.0);
试试

回答3:

FDSKFDSKLFK A FDSF DKSFKAAJFL’ DSFFDS FSDKFJKDSJF KDSFKDSAFKHSDK FHKDSFSKLFJKDFK