C++ open multiple ofstreams in a loop : <p>I need to open undefined number of files with ofstream to write in. the file names should have a format of plot1.xpm, plot2.xpm, plot3.xpm,... .
The program looks like this:
I don't know what should I place in stars.</p>

<pre><code>for(m = 0; m &lt; spf; m++){
    //some calculations on arr[]
    ofstream output(???);
    for(x = 0; x &lt; n; x++){
        for(y = 0; y &lt; n; y++){
            if (arr[x*n + y] == 0)
                output&lt;&lt;0;
            else output&lt;&lt;1;
        }
        output&lt;&lt;'\n';
        output.close();
    }
</code></pre>
