Boolean and Void problem
<p>So here is my code a little more edited however now I'm stuck on the success parameter:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;        // need this in order to use vectors in the program
using namespace std;

void computeSum (vector&lt;int&gt; &amp;Vec, int  howMany, int total, bool success) 
//the computeSum function that will sum positive numbers in a vector
{
success = true;
total=0;
if (success){
for(int j=0;j &lt; howMany;j++)
    if (Vec[j] &gt; 0){
    total+=Vec[j];
    } else { 
    total+=Vec[j+1];
    }
return total;
} else {
cerr &lt;&lt; "Oops!  Appears you cannot add up these numbers!";
}

}

int main()
{
vector&lt;int&gt; dataVec;

int i, n, howMany, total;
cout &lt;&lt; "How many numbers would you like to put into the vector? \n";
cin &gt;&gt; n; 

dataVec.resize(n);

for(vector&lt;int&gt;::size_type i=0;i &lt; n;i++)
{
    cout &lt;&lt; "Enter your number for " &lt;&lt; i+1 &lt;&lt; ": \n"; 
    cin &gt;&gt; dataVec[i];
}

cout &lt;&lt; "How many POSITIVE numbers would you like to sum? \n";
cin &gt;&gt; howMany;
cout &lt;&lt; "Your total is: \n" &lt;&lt; computeSum (dataVec, howMany, total, success);
}
</code></pre>

<p>When I compile it I get errors like this:
- return statement with a value in function returning void - so in that case would my "return total" in the if statement just print out the total?
- In also says in the int main() function that success was not declared - how would i go about declaring it?</p>
