求大牛相助撒。。。
统计立方数:#include<stdio.h>
#include<math.h>
int main()
{
int a[1000],i,j,term,count=0;
for(i=0;scanf("%d",&a[i])!=0;i++)
{
scanf("%d",&a[i]);
for(j=1;j<pow(2,32);j++)
{
term=pow(j,3);
}
if(term==i)
{
count++;
}
}
printf("%d",count);
}
哪里错了?
[解决办法]
加断点自己调试,
[解决办法]
谁说你错了?问他!
[解决办法]
scanf("%d",&a[i])!=0 这什么意思
[解决办法]
for(i=0;scanf("%d",&a[i])!=0;i++) 这行代码错了
你的搞明白scanf函数的返回值的含义
These functions return the number of input items successfully matched and assigned, which can be fewer than
provided for, or even zero in the event of an early matching failure.
a你是个int类型的数组, 总能匹配成功, 永远返回1, 1!=0 总是成功, 死循环了。
[解决办法]