replacing an element value in a vector
<p>so i am doing a inventory program. I have a vector of class items in it and I want to user enter Id and then run an iterator to match with the Id that is in the vector and change the value of the quantity sold:</p>

<p>here is part of my code:</p>

<pre><code> vector&lt;Item&gt;::const_iterator it;
  for(it=items.begin(); it !=items.end(); it++){
    if (it-&gt;getID() == id){
      amount=it-&gt;getactual()-sold;
      it-&gt;setactual(amount);
</code></pre>

<p>that is in my class</p>

<pre><code>int getactual()const{return actual_quantity;}
void setactual(int quantity){actual_quantity=quantity;}
</code></pre>

<p>but i get an error: passing ‘const Item’ as ‘this’ argument of ‘void Item::setactual(int)’ discards qualifiers</p>
