C++逐行读取txt中的数据,并保存到数组中
C++逐行读取txt中的数据,并保存到数组中
日期:2011-02-24 17:00:23 人气:1
刚刚写了个,自己看看吧,应该看得明白。
#include
#include
using namespace std;
void main()
{
fstream file;
file.open("s.txt",ios::in);
if(!file)
cout<<"file not founded"<<endl;
int a [100];
int pos = 0;
while(!file.eof()