title: Creating new txt files with c++ program, naming with variables
body: <p>I have created a program and I want to create with it files like aff1.txt, aff2.txt, etc. In these files, I want to have here a text created this way: It will open the file: text.txt and it will take each sentence, copy it 4700/sentence length times to each file. But it isn't working, when: <code>cout &lt;&lt; ss &lt;&lt; endl;</code>, it writes to cmd nothing, while there should be something, which was assigned before. What should I do?</p>
  <pre><code>    #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;cstring&gt;
  #include &lt;cmath&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  #include &lt;string&gt;
  #include &lt;string.h&gt;
  #include &lt;sstream&gt;
  
  using namespace std;
  
  int main()
  {
      ifstream vstup(&quot;text.txt&quot;); // 4700,2700,2200,1700
      string vety;
      getline(vstup,vety);
      vstup.close();
      string ss=&quot;affn.txt&quot;;
      char q[vety.length()];
      for (int u=0;u&lt;vety.length();u++)
      {
       q[u] = vety[u];
      }
      int l=0,m=0,n=0;
      int v,i,e,o;
      char vl[999999];
      //cout &lt;&lt; vety.length() &lt;&lt; endl;
      for (i=0;i&lt;vety.length();i++)
      {
  
        //cout &lt;&lt; &quot;ss&quot; &lt;&lt; endl;
        if (q[i]=='.')
        {
           // cout &lt;&lt; &quot;ss&quot; &lt;&lt; endl;
         v=4700/i;
         for (e=0;e&lt;v;e++)
         {
            //cout &lt;&lt; &quot;ss&quot; &lt;&lt; endl;
           for (o=0;o&lt;i-l;o++)
         {
            // cout &lt;&lt; &quot;ss&quot; &lt;&lt; endl;
            m=o+e*(i-l);
           vl[m]=q[o+l];
         }
         }
         l=l+i;
         cout &lt;&lt; vl &lt;&lt; endl;
         n++;
         //ofstream aff(&quot;aff.txt&quot;);
         //aff &lt;&lt; vl &lt;&lt; endl;
         //aff.close();
         ss[3]=n;
         ofstream writer(ss.c_str());
           //writer.open(ss.c_str());
          writer &lt;&lt; vl &lt;&lt; endl;
          writer.close();
          cout &lt;&lt; ss &lt;&lt; endl;
          ss.clear();
        }
      }
      return 0;
  }
  </code></pre>