title: error c2106: '=' : left operand must be I-value
body: <p>I am trying to do an if statement in a for loop and it gives me the following issue: "error c2106: '=' : left operand must be I-value" next to each of my if loops.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  // Function of given equation
  double function(double x)
  {
      double result;
          result = 0.2+25*x-200*pow(x,2)+675*pow(x,3)-900*pow(x,4)+400*pow(x,5);
      return result;
  }
  
  int main()
  
  {
      double boundup;         // Upper bound
      double bounddown;       // Lower bound
      double n;               // Number of intervals
      double step;            // Step size
      double fsimp;           // Simpson's rule
      double ftrap;           // Trapezoidal rule 
  
      cout &lt;&lt; "Enter lower bound: " ;
      cin &gt;&gt; bounddown;
  
      cout &lt;&lt; "Enter upper bound: " ;
      cin &gt;&gt; boundup;
  
      cout &lt;&lt; "Number of intervals: " ;
      cin &gt;&gt; n;
  
      // Vector class for both x and fx
      vector&lt;double&gt; x(n+1);
      vector&lt;double&gt; fx(n+1);
  
      // Define first and last values in x and fx because they will not change
      step = (boundup-bounddown)/n;
      x[0] = bounddown;
      x[n] = boundup;
  
      fx[0] = function(x[0]);
      fx[n] = function(x[n]);
  
      fsimp = fx[0];
  
      for (int i=0; i&lt;n; i++)
      {
          x[i+1] = x[i]+step;
          fx[i+1] = function(x[i+1]);
  
          if (i%2=0)
          {
              fsimp = 2*fx[i+1] + fsimp;
          }
  
          if (i%2=1)
          {
              fsimp = 4*fx[i+1] + fsimp;
          }
  
          fsimp = fx[n] + fsimp;
      }
  
      cout &lt;&lt; "Bounds of integration: " &lt;&lt; bounddown &lt;&lt; ", " &lt;&lt; boundup &lt;&lt; endl;
      cout &lt;&lt; "Number of intervals: " &lt;&lt; n &lt;&lt; '\n' &lt;&lt; endl;
      cout &lt;&lt; "Integral value of f(x): " &lt;&lt; fsimp &lt;&lt; endl;
  
  return 0;
  }
  </code></pre>
  
  <p>I am just trying to do a numerical integration using Simpson's rule.  Not sure how else I would do those if statements.</p>