I am running an algorithm and it must output several results into unique files.
I could do if-statements and open each file one at a time, however I rather keep it concise.
for (int i = 1; i < 5; i++)
{
outputfile(i).open("thisfile"&i&".txt");
}
...
On compilation I get this:
error *outputfile* was not declared in this scope.
The error refers to: outputfile(i).open("thisfile"i".txt");
where I have inserted: (i) into the filename. I have tried using '' and "" around i. I also have tried:
for (int i = 1; i < 5; i++)
{
char fileNum = '0' + i;
outputfile(fileNum).open("thisfile"&fileNum&".txt");
}
...and get the error: character constant too long for its type.