为什么wheat_sum最后结果是-1,我分步调试并没有问题
#include <stdio.h>
#include <stdlib.h>
#define NL '\n'
#define S(r) 3.14*r*r
#define C(r) 3.14*r*2
int main(void)
{
//舍罕王的失算,麦子
int wheat_sum = 3,num,each_grid = 2;
float one_wheat,total ;
for (num = 3; num < 65; num++)
{
each_grid= each_grid * 2;
wheat_sum += each_grid;
}
total = wheat_sum /25000;
printf("半径为%d的圆,面积是:%.2f,周长是:%.2f\n",r, S(r),C(r) );
printf("半径为%u的圆,面积是:%.2f,周长是:%.2f\n",me, S(r),C(r) );
printf("my sesult=: %d \n", my_sum);
printf("%d \n",wheat_sum);
printf("wheat=: %f \n", total);
return 0;
}
或许是数据太大,int 装不下 chxchxkkk 发表于 2020-6-8 22:29
或许是数据太大,int 装不下
机智
页:
[1]