DONE从文件中读入整数
//我想从in.txt中读入整数,while中的循环条件是什么?我不会,谢谢~~#include<stdio.h>
main()
{
FILE *in;
int a[100],i;
i=0;
in=fopen("in.txt","r");
do{
fscanf(in,"%d",&a[i]);
i++;
}while();
printf("%d",i);
}
in.txt:
123 234 345 456
[此贴子已经被作者于2007-11-18 10:35:13编辑过]
----------------解决方案--------------------------------------------------------
while(fscanf(in,"%d",&a[i])!=EOF)
{
// do something as you want
i++;
}
by 雨中飞燕 QQ:78803110 QQ讨论群:5305909
[url=http://bbs.bc-cn.net/viewthread.php?tid=163571]请大家不要用TC来学习C语言,点击此处查看原因[/url]
C/C++算法习题(OnlineJudge):[url]http://yzfy.org/[/url]
----------------解决方案--------------------------------------------------------
学习。
----------------解决方案--------------------------------------------------------
学习ING
----------------解决方案--------------------------------------------------------