title: C++ How Do You Pass Multiple Parameters?
body: <p>Let's assume I have a probability class with a method that computes the average of an array. Because it's possible that this method be passed an array of floats, doubles, ints, etc, I assumed it would be appropriate to make this method a template method.</p>
  
  <p>But when passing an array, I have to define a the type of array and length of an array. So my question is: how do I configure the template to accept two inputs? I have referenced the web but have had limited luck in seeing a good example.</p>
  
  <ul>
  <li>Is it valid to define templates to accept parameters that are ints, floats, etc.? </li>
  </ul>
  
  <p>I've posted my code below</p>
  
  <p>Probability Header</p>
  
  <pre><code>#ifndef COFFEEDEVMATH_PROBABILITY_H
  #define COFFEEDEVMATH_PROBABILITY_H
  
  class Probability
  {
      public:
           Probability(void);
          template &lt;typename T, int N&gt;
          void ExpectedValueDataSet(const std::array&lt;T, N&gt;&amp; data)
          {
              T test = data[0]; // This is irrelevant, but simply a place holder example.
          }
  
      protected:
      private:
  };
  
  #endif // COFFEEDEVMATH_PROBABILITY_H
  </code></pre>
  
  <p>Main</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;Probability.h&gt;
  
  int main()
  {
  
      float hoor[] = {3, 3, 1, 1};
      Probability prob;
      prob.ExpectedValueDataSet(hoor, 4);
  
  }
  </code></pre>