Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>for(int j=i; j&lt;= i ;j++) </code></pre> <p>This code makes zero sense you don't need a loop here. The reason is it will only ever have once case.</p> <p><code>i = j</code> you're setting <code>j</code> to <code>i</code> there for <code>j</code> can never been less then <code>i</code>.</p> <pre><code>for(int i=0; i &lt; num; i++) { cout &lt;&lt; "Enter the name for score # " &lt;&lt; i+1 &lt;&lt; " :"; cin &gt;&gt; name; t[i] = name; cout &lt;&lt; "Enter the score for score # " &lt;&lt; i+1 &lt;&lt; " :"; cin &gt;&gt; score; m[i] = score; } </code></pre> <p>this is the same thing you wrote essentially. </p> <p>EDIT UPDATE:</p> <p>Well to answer what the OP was actually asking.... I suppose. </p> <p>It's simply because you aren't including <code>&lt;string&gt;</code> </p> <p>here is the entire project with a couple of optimizations and error checks. </p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int main() { const int num = 5; string t[num], test; int m[num]; bool integer = false; for(int i=0; i &lt; num; i++) { cout &lt;&lt; "Enter the name for score # " &lt;&lt; i+1 &lt;&lt; " :"; cin &gt;&gt; t[i]; cin.clear(); cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n'); integer = false; while(integer == false){ cout &lt;&lt; "Enter the score for score # " &lt;&lt; i+1 &lt;&lt; " :"; cin &gt;&gt; m[i]; if(!std::cin.fail()) integer = true; cin.clear(); cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n'); } } for(int i=0; i &lt; num; i++) cout &lt;&lt; m[i] &lt;&lt; endl; } </code></pre> <p>I felt the need for the name and score variables were pointless you can just directly store them into your array. <strong>Also, I would make sure you do some error checking to see when you are <code>cin</code> ints they are actually ints not a string.</strong> Hope this helps. </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