Note that there are some explanatory texts on larger screens.

plurals
  1. POProgram execution different in Code::Blocks and remote linux server
    text
    copied!<p>So I have this code:</p> <pre><code>using namespace std; #include &lt;list&gt; #include &lt;iostream&gt; #include &lt;string&gt; #include "JugadorEscacs.h" void inserirOrdenat(list&lt;JugadorEscacs&gt; &amp;l, JugadorEscacs jug) { bool inserit=false; list&lt;JugadorEscacs&gt;::iterator itt=l.begin(); while(itt!=l.end() &amp;&amp; !inserit) { if(itt-&gt;getElo()&gt;jug.getElo()) itt++; else { l.insert(itt,jug); inserit=true; } } if(itt==l.end()) l.push_back(jug); } int main () { list&lt;JugadorEscacs&gt; l; string nom, cognom, pais; int elo; getline(cin, nom); while(nom!="FI") { getline(cin, cognom); getline(cin, pais); cin &gt;&gt; elo; cin.ignore(); JugadorEscacs jug(nom, cognom, pais, elo); if(l.empty()) l.push_front(jug); else inserirOrdenat(l, jug); getline(cin, nom); } list&lt;JugadorEscacs&gt;::iterator it=l.begin(); while(it!=l.end()) { cout &lt;&lt; it-&gt;getNom() &lt;&lt; endl; cout &lt;&lt; it-&gt;getCognoms() &lt;&lt; endl; cout &lt;&lt; it-&gt;getPais() &lt;&lt; endl; cout &lt;&lt; it-&gt;getElo() &lt;&lt; endl; it++; } return 0; } </code></pre> <p>The .cpp and .h are correct. When I run it on my PC using code blocks it works perfectly, but when I run it using PuTTy to connect to a linux server nothing happens. I compile it using <code>g++ main.cpp JugadorEscacs.cpp -o main</code> and I use a .txt to enter everything. The .txt is in the same directory as the main but when I run it using <code>./main &lt;test1.txt</code> nothing happens, it returns back to the command prompt. I don't know how to explain it in a better way, can anyone give me a hand with this? Thanks</p>
 

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