QVector to Complex
<p>I am trying to assign part of a <code>QVector</code> double array to complex double array in Qt.  </p>

<p>Running the following code, I have the problem that <code>std::cout &lt;&lt; y.at(i) &lt;&lt; std::endl;</code> correctly prints a 16-bit integer value but <code>std::cout &lt;&lt; y1[i] &lt;&lt; std::endl;</code> prints zeros: (0,0) (0,0) (0,0) ... </p>

<p>I would like the result (y[0],0) (y[1],0) (y[2],0)...</p>

<p>Please can someone advise what is wrong?</p>

<pre><code>QVector&lt;double&gt; x(100), y(100);  // Original QVector

std::complex&lt;double&gt; y1[100];
int i=0;

while(i&lt;101)
{  
   // get y values from somewhere else (quint8 data8)

   y[i] = (256.0*data8[2*i]) + 1.0*data8[2*i+1];
   std::cout &lt;&lt; y.at(i) &lt;&lt; std::endl;

   y1[i] = (y.at(i),0.0);
   std::cout &lt;&lt; y1[i] &lt;&lt; std::endl;

   i++;
}
</code></pre>