Dear all gurus,
Given 30 files, with same format (2 columns, column1 is string and column2 is int. contains thousands of lines) and uniform file name, eg: file1.txt, file2.txt,...,file30.txt,
How can i read it in a loop, and then load them into my 2D array (eg: string words [filesize][maxline], and int numbers [filesize][maxline])?
Tried to use strcat and append but cant work coz the integer i:
ifstream infile;
int indexx;
string st1 = "file";
string st2 = ".txt";
for (int i=0; i<filesize; i++)
{
infile.open(strcat(strcat(st1,(strcat((string)i,st2))),ios::in)
while (!infile.eof())
{
infile>>words[i][indexx]>>numbers[i][indexx];
indexx++;
}
infile.close();
}
That are parts of my data mining project. Every help and advise would be much appreciated. Thanks.
:)