|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我快要疯了,,,,,,
这是小甲鱼的代码
#include <stdio.h>
#include <math.h>
int main()
{
unsigned long long sum = 0;
unsigned long long temp;
unsigned long long weight;
int i;
for (i=0; i < 64; i++)
{
temp = pow(2, i);
sum = sum + temp;
}
weight = sum / 25000;
printf("舍罕王应该给予达依尔%llu粒麦子!\n", sum);
printf("如果每25000粒麦子为1kg,那么应该给%llu公斤麦子!\n", weight);
return 0;
}
这是我的代码
#include<stdio.h>
#include<math.h>
int main()
{
unsigned long long int result = 2;
int i;
unsigned long long int re;
re = 0;
if (i=0; i < 64; i++);
{
result = pow(2, i);
re = re + result;
}
re = result / 25000;
printf("舍罕王需要付给达依尔%ukg麦子",re);
return 0;
}
然后。。。两个都无法运行????!!!
小甲鱼的代码的错误指示是
Compiling...
3.c
d:\c语言\class 6\3.c(6) : error C2632: 'long' followed by 'long' is illegal
d:\c语言\class 6\3.c(7) : error C2632: 'long' followed by 'long' is illegal
d:\c语言\class 6\3.c(8) : error C2632: 'long' followed by 'long' is illegal
d:\c语言\class 6\3.c(13) : warning C4244: '=' : conversion from 'double ' to 'unsigned long ', possible loss of data
执行 cl.exe 时出错.
3.obj - 1 error(s), 0 warning(s)
救我。。。。。我卡这个作业卡到要疯了。。。。。。。 |
|