Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>However the program quits after it instead of continuing to the next subfunctions.</p> </blockquote> <ul> <li>You call <code>input_dimensions()</code> inside <code>conclusion()</code>.</li> <li>When <code>input_dimensions()</code> return, execution will proceed at the next statement inside <code>conclusion()</code>.</li> <li>When <code>conclusion()</code> returns, execution will proceed in <code>main()</code> the statement after the call to <code>conclusion()</code>.</li> <li>There, you have three more statements inside <code>main()</code> to run, then your program exits.</li> </ul> <p>C++ does not run statements more than once unless you tell it to, so the function calls in <code>main()</code> are only run one time only (you don't have any loops there).</p> <p>Here is a possible solution to your problem:</p> <p>Instead of having all the function calls in <code>main()</code>, you can make the functions call each other like this:</p> <pre><code>void welcome(); void input_dimenstions(); void conclusion (); void initial_calculations (); void welcome () { input_dimensions(); } void input_dimensions () { initial_calculations(); } void initial_calculations () { conclusion(); } void conclusion () { if (...) { input_dimensions(); } else { ... } } int main(int argc, char **argv) { welcome(); } </code></pre> <p>This way you can control where to make the program go next inisde each function instead of letting <code>main()</code> do that, which usually gets messy really quick.</p> <p>By declaring all functions at the top, you don't have to worry about the order of them later.</p>
    singulars
    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.
 

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