title: find the value of x in polynomial c++
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;sstream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  int main()
  {
      vector&lt;double&gt; coefficients;
      cout &lt;&lt; "Enter the polynomial coefficients (increasing degree): ";
      string line;
      getline(cin,line);
      istringstream input_string(line);
  
      double coefficient;
      while (input_string &gt;&gt;coefficient)
      {
          coefficients.push_back(coefficient);
      }
  
      double x;
      cout &lt;&lt;"Enter the x value: ";
      cin &gt;&gt; x;
  
      double value = 0,power_x = 1;
      for (int i = 0; i &lt; coefficients.size(); i++)
      value += coefficients[i] * power_x;
      power_x *= x;
  
  
      cout &lt;&lt; "The value of the polynomial at x = " &lt;&lt; x &lt;&lt; " is " &lt;&lt; value &lt;&lt; endl;
      system ("pause");
  }
  </code></pre>
  
  <p>Hey guys, writing a program to calculate the value of x for a polynomial with increasing degree, here's my program and my prof wants me to enter the following as inputs:<br>
  1 0 1 for the coefficients 
  1.5 for the value of x 
  but my output gives me 2 instead of 3.25 which is the correct answer. </p>