wii编辑器怎么用:for语句的问题

来源:百度文库 编辑:高校问答 时间:2024/04/30 02:37:52
按1.5%的增长速度,现有人口13亿,到2010年将有多少人口。
(用for语句写)

楼上的程序有问题了,按你说,明年(2007年)将有人口19.5亿了,2008年以后人口就不再增长了。
#include<iostream.h>
void main()
{
float temp,i,j=13,all;
for(i=2006;i<=2010;i++)
{
temp=j*3;
all=j+temp/200;
j=all;
}
cout<<temp<<endl;
}

#include<iostream.h>
void main()
{
float temp,i,j,all;
for(i=2006,j=13;i<2010;i++,j=all)
{

temp=j*3;
all=temp/2;
}
cout<<all<<endl;
}
vc 编译通过 单位:?
对不起刚才没有注意看,谢谢楼下!:)