title: Returning pair from a function in C++?
body: <p>I am a beginner in C++ and I faced the following problem:
  In my program I have a function to which I pass an array with fixed size as a parameter. I iterate through it and perform some operations. As a result I have 2 variables - <code>br</code> and <code>a</code>, which I want to return from the function. I create a pair and assign to it these values. However when I run the whole program the compiler throws an error - cannot convert std::pair&lt;> to int. I would like to ask why this happens?</p>
  
  <pre><code> #include &lt;utility&gt;
    using namespace std;
    pair &lt;double,double&gt; rez;
    //int main() ...
     double sumaf(int k[20])
  {
  
      for(int i=0; i&lt;20; i++)
      {
          if(k[i]&gt;0 &amp;&amp; k[i]%3==0)
          {
              a+=k[i];
              br++;
          }
      }
  
      rez.first=a;
      rez.second=br;
      return rez;
  
  }
  </code></pre>