title: Dynamic arrays with C++
body: <p>my question refers to dynamic arrays in C++. I'm new at the language so please spell things out for me where possible.</p>
  
  <p>I was wondering how I could change the following code to accept floats?</p>
  
  <pre><code>   #include &lt;iostream&gt; // include library
  
  using namespace std;
  
     int main() // main function
        {
  int length;
          cout &lt;&lt; "Please enter the length of the array: "; // ask user for array
          cin &gt;&gt; length;
  
          int *dArray;
          dArray = new int[length];
  
          for (int i = 0; i &lt; length; i++)
          {
              dArray[i] = i;
          }
  
          for (   int i = 0;  i &lt; length; i++)
  
          {
              cout &lt;&lt; dArray[i] &lt;&lt; " ";
          }
          delete[] dArray;
    return 0;
  </code></pre>