title: C++ buffer manipulation
body: <p>My professor gave us an example main\source.cpp file and wants us to create the necessary class\header file to make it work. He's the no example code vague "helpful hints" type so I'm lost.</p>
  
  <p>I know this is a long post any input anyone may be willing to help me with at all would be a huge help.</p>
  
  <p>Source.cpp he provided;</p>
  
  <pre><code>#include &lt;iostream&gt;     // std::cout, std::endl
  #include &lt;iomanip&gt;      // std::setw
  #include &lt;string&gt;
  #include "DataBuffer.h"
  using namespace std;
  
  void testDataBuffer(int arr[], int length);
  int main() { 
      const int ARR0_LEN = 2; 
      int arr0[ARR0_LEN] = { -2,-1 }; 
      const int ARR1_LEN = 10; 
      int arr1[ARR1_LEN] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; 
      const int ARR2_LEN = 25; int arr2[ARR2_LEN] = { 2, 4, 6, 8, 10, 12, 14, 16, 7, 6, 22, 8, 9, 16, 5, 2, 7, 8, 12, 2, 0, 14, 17, 19, 22 }; 
      testDataBuffer(arr0, ARR0_LEN); 
      testDataBuffer(arr1, ARR1_LEN); 
      testDataBuffer(arr2, ARR2_LEN); 
      //hold console open
      std::cin.get();
      return 0; 
  }
  void testDataBuffer(int arr[], int length) {
      DataBuffer buf; buf.copyData(arr, length); 
      buf.print(); cout &lt;&lt; "Sum " &lt;&lt; buf.sum() &lt;&lt; endl; 
      cout &lt;&lt; "Min " &lt;&lt; buf.minValue() &lt;&lt; endl; 
      cout &lt;&lt; "Max " &lt;&lt; buf.maxValue() &lt;&lt; endl; 
      cout &lt;&lt; "Range " &lt;&lt; buf.range() &lt;&lt; endl; 
      cout &lt;&lt; "Mean " &lt;&lt; buf.mean() &lt;&lt; endl;
  }
  </code></pre>
  
  <p>My DataBuff.h</p>
  
  <pre><code>#include &lt;iostream&gt;     // std::cout, std::endl
  #include &lt;iomanip&gt;      // std::setw
  #include &lt;string&gt;
  #pragma once
  
  class DataBuffer {
          static const int BUFFER_SIZE = 256;
          int buffer[BUFFER_SIZE];
          static const int length = 5;
          int arr[length] = { 1,2,3,4,5 };
      public:
          bool copyData(int intArray, int length);
          string print();
          double mean(int sum);
          int sum();
          int maxValue();
          int minValue();
          int range(int small, int large);
   };
  </code></pre>
  
  <p>My DataBuffer.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;     // std::cout, std::endl
  #include &lt;iomanip&gt;      // std::setw
  #include &lt;string&gt;
  #include &lt;array&gt;        // .sizeof()
  #include "DataBuffer.h"
  using namespace std;
  
  bool DataBuffer::copyData(int arr, int length)  {   
      for (int i = 0; i &lt; length; i++) {
          arr = buffer[i];  
      }
      cout &lt;&lt; "Length of buffer is " &lt;&lt; length; 
      if (sizeof(buffer) &lt; length) {
          return false;
      }
      else {
          return true;
      }
  }
  
  string DataBuffer::print() { 
      if (length &lt;= 0) {
          cout &lt;&lt; "{}" &lt;&lt; endl;
      }
      else {
          cout &lt;&lt; buffer[0];
          for (int i = 1; i &lt; length; i++) {
              cout &lt;&lt; setw(10) &lt;&lt; buffer[i];
              cout &lt;&lt; endl;
          }
      }
  }
  
  int DataBuffer::sum()
  {
      int i, sum = 0;
      for (i = 0; i &lt; length; i++)
      {
          sum += buffer[i];
      }
      return sum;
  }
  
  double DataBuffer::mean(int sum) {
      double mean = sum / length;
      return mean;
  }
  
  int DataBuffer::maxValue() {
      int i = 0;
      int large = buffer[0];
      for (i = 1; i &lt; length; i++)
      {
          if (buffer[i] &gt; large)
              large = buffer[i];
      }
      return large;
  }
  
  int DataBuffer::minValue() {
      int i; 
      int small = buffer[0];
      for(i=1; i &lt; length; i++)
      {
          if(buffer[i] &lt; small)
              small = buffer[i];
      }
      return small;
  }
  
  int DataBuffer::range(int small, int large)
  {
      int range = large - small;
      return range;
  }
  </code></pre>
  
  <p>Main errors I'm stuck on;</p>
  
  <p>The professor states that range and mean should accept parameters, so why doesn't the method call in his cpp have parameters? I'm getting errors stating <code>range doesn't take 0 arguments</code></p>
  
  <blockquote>
    <p>Error    C3646   'print': unknown override specifier AustinNorrisBuffer  c:\users\austinn\downloads\austinnorrisbuffer\databuffer.h  19<br>
     Error    C2039   'print': is not a member of 'DataBuffer'    AustinNorrisBuffer  c:\users\austinn\downloads\austinnorrisbuffer\source.cpp    29  </p>
  </blockquote>
  
  <p>Again long post I know, any help appreciated!</p>