程序中出现这样的问题,怎么解决啊。。。求解
发布网友
发布时间:2023-07-17 03:43
我来回答
共1个回答
热心网友
时间:2023-07-19 16:51
#include <stdio.h>
#define SQUARES 64 //棋盘的方格数
#define CROP 1E15 //以粒计的小麦产量
int main (void)
{
double current ,total;
int count =1;
printf("square grains total"
"fraction of \n");
printf(" added grain ");
printf("US total\n");
total=current=1.0;//开始时是一粒
printf("%4d %13.2e %12.2e %12.2e\n",count,current, //.current 应该是,
total,total/CROP);
while (count<SQUARES)
{
count=count+1;
current=2.0*current;//下个方格数加倍
total=total+current;//更新总数
printf("%4d %13.2e %12.2e %12.2e\n",count,current, //.current 应该是,
total,total/CROP);
}
printf("That's all.\n");
return 0;
}