请大家帮我看看我的百鸡问提程序错在哪?

来源:百度知道 编辑:UC知道 时间:2024/07/03 04:19:03
void main()
{int a=0,b,c;
while(a<=19)
{b=0;
while(b<=33)
{c=100-a-b;
printf("%d %d %d\n",a,b,c);
b++;
}
a++;
}
}
在VC6.0中编译不过去!!请大家帮忙!
c=100-a-b;下面我忘了一句!!但不是这个错误!!
急切等待!!!答对马上确认!过了今天我就不知道了

你少了这个所以编译不了 请在最前面加入这行
#include <stdio.h>

不过你的程序出来的结果不是答案
准确程序如下

#include <stdio.h>
void main()
{ int cocks=0,hens,chicks;
while (cocks<=19)
{hens=0;
while(hens<=33)
{chicks=100-cocks-hens;
if (5.0*cocks+3.0*hens+chicks/3.0==100.0)
printf("%d %d %d\n",cocks,hens,chicks);
hens++;
}
cocks++;
}
}