title: C++ simple calculate score with arrays
body: <p>This is a practice assignment from my textbook to calculate a score. It takes 7 scores and drops the highest and lowest. </p>
  
  <p>I don't think there are syntax errors but I am getting an unresolved external symbol error. I looked for similar questions and it seemed that the problem may be with using a function but not defining it. I have defined all my functions, but probably incorrectly in either main or calculatescore. I am new to c++ and would appreciate any assistance in solving this issue. Thank you</p>
  
  <p>This is the error I got on VisualStudio</p>
  
  <p>error LNK2019: unresolved external symbol "float __cdecl calculateScore(float * const,int,float)" (?calculateScore@@YAMQAMHM@Z) referenced in function _main    </p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void printHeader(int judges);
  void enterData (float scores[], int judges, float difficulty);
  float calculateScore(float scores[], const int judges, float difficulty);
  int findLeast(float scores[], const int judges);
  int findMax(float scores[], const int judges);
  
  int main () {
      const int judges = 7;
      float scores [judges];
      float difficulty = 0;
      float finalscore = calculateScore(scores, judges, difficulty);
  
  
  
  printHeader (judges);
      enterData (scores, judges, difficulty);  // get user input
      findLeast(scores, judges); // find lowest score 
      findMax(scores, judges); // find highest score
      calculateScore (scores, judges, difficulty); // get final score
      cout &lt;&lt; "The final score is " &lt;&lt; finalscore &lt;&lt; '\n';
  
      return 0;
  }
  
  void printHeader(const int judges) {
      cout &lt;&lt; "This program calculates a divers score over" &lt;&lt; judges &lt;&lt; "judges"; 
  }
  
  void enterData(float scores[], const int judges, float difficulty) {
      for (int i = 0; i &lt; judges; i++){
          cout &lt;&lt;"Enter score for judge " &lt;&lt; i+1 &lt;&lt; endl; 
          cin &gt;&gt; scores[i];
      }
      cout &lt;&lt; "Enter difficulty: "&lt;&lt; endl;
      cin &gt;&gt; difficulty;
  }
  </code></pre>
  
  <p>This is my function to calculate score that is called in main. Should it be a void function instead?</p>
  
  <pre><code>float calculateScore(float scores[], const int judges, float difficulty, int maxScore, int least) {
      float sum = 0;
          for (int i = 0; i &lt; judges; i++) {
          sum += scores[i];
      }
      return sum - scores[least] - scores[maxScore] * difficulty * .6;
  }
  
  
  int findLeast(float scores[], const int judges) {
      int least = 0;
      for (int i = 1; i&lt; judges; i++)
          if (scores[i] &lt; scores[least])
              least = i;
      return least;
  }
  
  int findMax(float scores[], const int judges) {
      int maxScore = 0;
      for (int i = 1; i&lt; judges; i++)
          if (scores[i] &gt; scores[maxScore]) {
              maxScore = i; 
          }
      return  maxScore;
  }
  </code></pre>