for 语句
程序代码:
# include <stdio.h> int main() { float score[3] = {1, 3, 5}; int i, n = 0; float below[3]; for (i=0; i<3; i++) if (score[i] < 6) { below[n] = score[i]; n++; printf("test! "); } for (i=0; i<n; i++) printf("%d ", below[i]); printf("\n"); return 0; }
在VC++6.0的结果:
test! test! test! 0 0 0
-----------------------------------------------
根据我计算的是结果是:
test! test! test! 1 3 5
-----------------------------------------------
我的代码应该是没错的吧,
求大神帮忙看看哪里有问题