Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should decide first, what variables are input and what variables should carry output. Try to not use one variable for both input and output, it is often more confusing than valuable.</p> <p>Only input value is x. Everything else is output values. In way you have used that values, content of values is modified only in local copy inside function printNumbers(). They will get lost on end of function. I expect you want to output computed results from function (however then printNumbers is wrong name for that function).</p> <p>C and C++ always pass variables to function parameters by value. That means, variable is initialized from parameter, but any changes are done only inside function. At the end of function, copy is discarded and will NOT change anything you passed to it.</p> <p>If you want output from function, you can use return, or use pointers or references to a variable. I suggest to use references in C++, they are easier to understand and easier to use.</p> <p>Use references instead of copied variables in function. Then, when you modify that value inside function, it will keep modified value after function return.</p> <pre><code>void f1(int in, int out) { out = in + 1; } void f2(int in, int &amp;out) { out = in + 1; } int o1=-1, o2=-1; f1(1, o1); f2(1, o2); cout &lt;&lt; o1 &lt;&lt; "," &lt;&lt; o2 &lt;&lt; endl; // will print -1,2 </code></pre> <p>So declare your function as: void printNumbers(int x, double &amp;y, double &amp;z, double &amp;v, int &amp;sum, double &amp;sum2,int &amp;sum3,int &amp;sum4);</p> <p>you can then do:</p> <pre><code>double y,z; int sum, sum2, sum3, sum4; printNumbers(4, y, z, sum, sum2, sum3, sum4); printFooters(sum); </code></pre> <p>And this time, it should print whatever printNumbers computed. See <a href="http://www.cprogramming.com/tutorial/references.html" rel="nofollow">http://www.cprogramming.com/tutorial/references.html</a> for a bit more, or use google.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload