title: error: size of array ‘u’ has non-integral type ‘double’|
body: <p>i have the following code and i am receiving the error  " size of array ‘u’ has non-integral type ‘double’|"</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include &lt;cstdio&gt;
  #include &lt;cstdlib&gt;
  #include &lt;fstream&gt;
  
  
  #define steps 1000.0
  #define time 1000.0
  
  using namespace std;
  
  
  int main()
  {
  
  double u[steps][time];
  double a;
  int data[10];
  
  cout &lt;&lt; "Please enter the value of ratio  cdt/dx :"&lt;&lt;endl;
  cin &gt;&gt; a;
  
  
  //initialize matrix u
  
  for (int i=0;i&lt;steps;i++)
          for (int j=0;j&lt;time;j++)
              u[i][j]=0;
  
  // fill matrix u
  
  for (int i=1;i&lt;time-1;i++) {
      for (int j=1;j&lt;steps-1;j++){
          if (i==1)
          u[j][i]=0; //initial condition
          else
          if (j==1 &amp;&amp; i&gt;=1 &amp;&amp; i&lt;=50)
                      u[j][i]=50;
          else
              u[j][i+1]=pow(a,2)*(u[j+1][i]-2*u[j][i]+u[j-1][i])+2*u[j][i]-u[j][i-1]; //solution of wave equation
  
      }
      }
  
  //create and open data files
  for (int k=1;k&lt;=10;k++){
  ofstream data[k];
  data[k].open("Data"data[k]".dat");
  
  }
  
  //fill files with data
  for (int i=1;i&lt;steps;i++){
  data1&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][99]&lt;&lt;endl;
  data2&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][199]&lt;&lt;endl;
  data3&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][299]&lt;&lt;endl;
  data4&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][399]&lt;&lt;endl;
  data5&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][499]&lt;&lt;endl;
  data6&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][599]&lt;&lt;endl;
  data7&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][699]&lt;&lt;endl;
  data8&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][799]&lt;&lt;endl;
  data9&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][899]&lt;&lt;endl;
  data10&lt;&lt;i&lt;&lt;"\t"&lt;&lt;u[i][999]&lt;&lt;endl;
  
  }
  
  //close files
  for (int k=1;k&lt;=10;k++){
  data[k].close();
  }
  
      return 0;
  }
  </code></pre>
  
  <p>Is this error about the size of u ?And how can i overcome it?
  Also, in this part of code </p>
  
  <pre><code>//create and open data files
      string k;
      stringstream ss;
      ss &lt;&lt; k;
      filename += ss.string();
      string filename = "Data";
      for (int k=1;k&lt;=10;k++){
      ofstream data[k]; 
      filename += data[k]; 
      filename += ".dat";
      data[k].open(filename);
         }
  </code></pre>
  
  <p>it gives me "filename' was not declared " and " ‘struct std::stringstream’ has no member named ‘string’"</p>
  
  <p>I did that loop because i was trying to avoid the</p>
  
  <p>ofstream data1; ofstream data2;.......
  Can i make it work?</p>
  
  <p>Thank you!</p>