Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have many problems with your code:</p> <ul> <li>Like I mentioned in a comment, <code>my_Values [MAXSIZE] = 0;</code> in the constructor writes <em>one beyond</em> the max index of the array.</li> <li>You also do this in other places. You can't use <code>MAXSIZE</code> as index, since index goes from <code>0</code> to <code>MAXSIZE - 1</code>.</li> <li>You can't add an array to another array like you do in <code>addScores</code>.</li> </ul> <p>Using the facilities provided by the standard library (see <a href="http://en.cppreference.com/w/cpp" rel="nofollow">here for a good reference site</a>) will really help you now and in the future.</p> <hr> <p>In the future, whenever you think about a dynamic array of any kind, you should be thinking about <a href="http://en.cppreference.com/w/cpp/container/vector" rel="nofollow"><code>std::vector</code></a>.</p> <p>For example, adding a value to a vector is as simple as</p> <pre><code>std::vector&lt;int&gt; vector; vector.push_back(123); </code></pre> <p>To insert an old-style array, like you want to do in your <code>addScores</code> function, you can use <a href="http://en.cppreference.com/w/cpp/algorithm/copy" rel="nofollow"><code>std::copy</code></a> together with <a href="http://en.cppreference.com/w/cpp/iterator/back_inserter" rel="nofollow"><code>std::back_inserter</code></a>:</p> <pre><code>std::copy(array, array + size, std::back_inserter(vector)); </code></pre> <p>To keep the vector sorted, use the <a href="http://en.cppreference.com/w/cpp/algorithm/sort" rel="nofollow"><code>std::sort</code></a> standard function:</p> <pre><code>std::sort(std::begin(vector), std::end(vector)); </code></pre>
    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. VO
      singulars
      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