Note that there are some explanatory texts on larger screens.

plurals
  1. POArray Classes - Get Largest and Smallest Value
    text
    copied!<p>I am really stuck on WHERE ON EARTH to go for this problem.</p> <p>If someone can push me into the right direction. I would be deeply grateful</p> <p>The following is my code</p> <p><strong>Grader.h</strong></p> <pre><code>#ifndef GRADER_H #define GRADER_H #define MAXSIZE 100 #include &lt;iostream&gt; #include &lt;cstdlib&gt; class Grader { public: Grader( ); void addScore( int score ); void addScores( int scores[], int size ); void clear(); int findBiggest( ) const; int findSmallest( ) const; private: int my_Values[ MAXSIZE ]; int my_ValuesSeenSoFar; }; #endif </code></pre> <p><strong>Grader.cpp</strong></p> <pre><code>#include &lt;iostream&gt; #define MAXSIZE 100 #include "Grader.h" Grader::Grader( ){ my_Values [MAXSIZE] = 0; my_ValuesSeenSoFar = 0; } void Grader::addScore( int score ){ my_Values[MAXSIZE] = score; } void Grader::addScores( int scores[], int size ){ my_Values[MAXSIZE] = scores[size]; } void Grader::clear(){ my_Values[0]; } int Grader::findBiggest() const{ int i; for (i = 0; i &lt; MAXSIZE; i++) return my_Values[i]; } int Grader::findSmallest( ) const{ } </code></pre> <p><strong>Driver.cpp</strong></p> <pre><code>#include &lt;iostream&gt; #include "Grader.h" using namespace std; int main( ) { Grader g; double d[5]= {99,70,85,93,84}; double e[4]= {100,81,60,91}; g.addScore( 75 ); g.addScore( 82); g.addScores( d, 5 ); cout &lt;&lt; "Best Score = " &lt;&lt; g.findBiggest( ) &lt;&lt; endl; /// should give value 99 cout &lt;&lt; "Worst Score = " &lt;&lt; g.findSmallest( ) &lt;&lt; endl; /// should give value 70 g.clear( ); g.addScore( 50 ); g.addScore( 74 ); g.addScores( e, 4 ); cout &lt;&lt; "Best Score = " &lt;&lt; g.findBiggest( ) &lt;&lt; endl; /// should give value 100 cout &lt;&lt; "Worst Score = " &lt;&lt; g.findSmallest( ) &lt;&lt; endl; /// should give value 50 } </code></pre> <p>I am having trouble figuring out a) How exactly to implement the addScore/addScores</p> <p>and b) how to call those scores into the findBiggest and findSmallest.</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