Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>your first syntax error is because of having another <code>&lt;&lt;</code> at the end of statement <code>cout&lt;&lt;F&lt;&lt;;</code> just change it to <code>cout&lt;&lt;F;</code> unless you have another var to print or you want to use endline like: <code>cout&lt;&lt;F&lt;&lt;endl;</code>.</p> <p>you have another one syntax error too! your <code>main</code> returns int but you didn't returned anything at the end:</p> <p><code>return 0;</code></p> <p><strong>Another very very very important issue is about the variable <code>F</code>!</strong></p> <p><strong>Logical error!!!</strong></p> <pre><code>int main() { .... float S_dist; //real S_dist !!! float E_dist; //real E_dist !!! float F; //real F !!! for (t=0; t&lt;30000; t++) { float F; // just exists in for!!! float E_dist; //just exists in for!!! float E_dist; //just exists in for!!! .... F=(G*Me*Ms)/(r*r); //changing local F, which just exists in for E_dist=sqrt( ((pe[0]-pe[0])*(pe[0]-pe[0])) + ((pe[1]-pe[1])*(pe[1]-pe[1])) ); S_dist=sqrt( ((ps[0]-ps[0])*(ps[0]-ps[0])) + ((ps[1]-ps[1])*(ps[1]-ps[1])) ); } cout&lt;&lt;F&lt;&lt;E_dist&lt;&lt;S_dist; //this prints the main vars! return 0; } </code></pre> <p>be sure to read about local variables more. and keep in mind that <code>t+1</code> doesn't change the <code>t</code> at all! you should write <code>t++</code> or <code>t+=1</code> in the last part of the <code>for</code> statement instead! unless you will get an infinite loop, cause your <code>t</code> does not grow at all!</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.
    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