这样就可以了:
#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;
}
}
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);
试试
FDSKFDSKLFK A FDSF DKSFKAAJFL’ DSFFDS FSDKFJKDSJF KDSFKDSAFKHSDK FHKDSFSKLFJKDFK