Code:
map<string, int> info[argc-1];
The value of argc is not known to the compiler (it differs on each runtime), so it cannot create a usual, fixed-sized array. Instead your compiler as an extension allows you to create variable-sized arrays. Other compilers may not have that extension and your code may not be compilable for others.
It was suggested to use a vector:
Code:
vector<map<string, int> > info(argc - 1);
Code:
while(!fin.eof())
{
fin>>word;
if(info[i-1].count(word) <0 )
info[i-1][word];
else
info[i-1][word]++;
}
Firstly, read the FAQ about why you shouldn't control the input loop with eof() (this code has potential for "reading" the last word twice). The logic here about the map is a bit over-complicated too. I guess the if part is never executed (count of matches less than 0? especially if count()'s return type is unsigned?), so you might just remove the conditional thing.
Code:
for(int i =0; i< info[i].size(); i++)
This is probably causing your crashes. I can't see the relationship between the size of each dictionary and the total number of input files but that's what you are using to control the loop.