error: cannot convert ‘std::basic_string<char>’ to ‘int’ in assignment
<p>im getting the above error for the following code. Please help me with what i am doing wrong.  This code has nested structures. For now it generates name for the generation structure based on the input given by the user.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include &lt;string&gt;
#include &lt;iomanip&gt;
#include &lt;limits&gt;
#include &lt;stdio.h&gt;
#include &lt;sstream&gt;


using namespace std;
using std::stringstream;
struct rootset {
  double totSize;
  const char *rStrtPtr;
  const char *rEndPtr;

  struct generations {
    double totSize;
    const char *genStrtPtr;
    const char *genEndPtr; 
    int numOfGen;
    int genName;

    struct object {
      double objSize;
      const char *objStrtPtr;
      const char *objEndPtr;
      string id;
      char markBit;
      char objPtr;


      struct freeList {
    double freeSpace;
    int flNumb; 
      };
    };
  } generation;
};

int main()
{

  int gen =0;
  cin &gt;&gt; gen;

  rootset* pRootSet = (rootset*)malloc(1200);

  for( i=0; i&lt;gen; i++) {
    stringstream out;
    out &lt;&lt; i;
   string s = out.str();
   string foo = "generation";

   pRootSet-&gt;generation.genName = foo.append(s);  /*Error is here*/
   cout&lt;&lt;"foo: "&lt;&lt;foo&lt;&lt;endl;
  }
}
</code></pre>

<p>i am trying to print this answer:</p>

<pre><code>4
foo: generation0
foo: generation1
foo: generation2
foo: generation3
</code></pre>
