title: How to return the array list of number has sum equal to the given number
body: <p>I am practicing in C++ about array. I am doing Sum of numbers in an array equal to the given number. I have code like this</p>
  <pre><code>bool hasArrayTwoCandidates(int arr[], int arr_size,
                         int sum)
  {
      int l, r;
   
      /* Sort the elements */
      sort(arr, arr + arr_size);
   
      /* Now look for the two candidates in 
         the sorted array*/
      l = 0;
      r = arr_size - 1;
      while (l &lt; r) {
          if (arr[l] + arr[r] == sum)
              return 1;
          else if (arr[l] + arr[r] &lt; sum)
              l++;
          else // A[i] + A[j] &gt; sum
              r--;
      }
      return arr[l];
  }
   
  /* Driver program to test above function */
  int main()
  {
      int arr[] = { 1, 4, 45, 6, 10, -8 };
      int n = 16;
      int arr_size = sizeof(arr) / sizeof(arr[0]);
   
      // Function calling
      cout&lt;&lt;hasArrayTwoCandidates(arr, arr_size, n);
   
      return 0;
  }
  </code></pre>
  <p>That's just displaying the text, I would like to show all the numbers in the array has given to know that what are the numbers in the array equal to the given number.</p>
  <p><strong>Example:</strong></p>
  <p>This is an array already declear:
  <strong>int arr[] = { 1, 4, 45, 6, 10, -8 };</strong></p>
  <p>And the output should be like this:
  <strong>List of number equal 16 is: 6, 10</strong></p>
  <p>How can I return that number, please help me with this, thank you so much</p>