2-sum problem in C++ I'm a beginner at C++; all my previous programming experience is mainly through PLCs in industrial maintenance. 

I have to accept 10 integers and a target value, then print all the pairs that sum to the target.

The pairs cannot be of the same integer.  For example, if the target value is 10 then we cannot have a pair of 5 + 5. This code basically executes well enough for me, however I get an overloaded int out at the end; I'm curious why that might be?

Also I understand there are much easier ways to accomplish this task. I feel pretty good with what I was able to come up with given the amount of time I have devoted so I certainly am fine with it, however I wouldn't mind seeing some examples how much more seasoned programmers would have attempted this, if anyone out there is bored.

#include&lt;iostream&gt;
#include&lt;algorithm&gt;
using namespace std;

int main()
{
    int run, a, b, ints[11], out[45];

    cout &lt;&lt; "\n\t\tAfter inputting 11 integers, this program will evaluate\n\tthe first 10 integers, then will display the pairs of said integers\n\twhich when added together the total will equal the 11th integer.";
    cout &lt;&lt; "\n\n\tPlease enter 11 integers: \n\n";

    for (run = 0; run &lt;= 10; run++)
    {
        cout &lt;&lt; "\t\t"; cin &gt;&gt; (ints[run]);
    }
    system("cls");
    run = 0;
    for (a = 0; a &lt; 10 &amp;&amp; run &lt;= 10; a++)
    {
        for (b = 1; b &lt; 10 &amp;&amp; run &lt;= 10; b++)
        {
            if (ints[10] == (ints[a] + ints[b]) &amp;&amp; ints[a] != ints[b] &amp;&amp; run &lt;= 10)
            {
                out[run] = ints[a];
                run++;
                out[run] = ints[b];
                run++;
            }
        }
    }
    cout &lt;&lt; "\n\t\tPerforming critical calculations . . .\n\t\t";
    system("pause");

    cout &lt;&lt; "\n\t\t";
    if (*max_element(out, out + 10) == 0)
        cout &lt;&lt; "No sum of integers found to equal desired total. ";
    else
    {
        cout &lt;&lt; "Pairs of integers that equal the desired total are as follows; ";
        for (int index = 0; index &lt; 11; index++)
        {
            if (out[index] &gt; 0)
            {
                cout &lt;&lt; "(" &lt;&lt; out[index++] &lt;&lt; " , " &lt;&lt; out[index] &lt;&lt; ")";
                if (index &lt; 11)
                    cout &lt;&lt; ", ";
                else if (index == 11)
                    break;
            }

        }
    }
    system("pause");
    return 0;
}
```
Algorithm:
It's brute-force, but for ten elements that's fine.  However, I don't think it will work correctly - it's going to stop at five pairs regardless of how many were generated.  

Also, the outer loop should stop before the last element and the inner loop should start one after the current value of the outer loop.  Otherwise you're just making the same comparison multiple times.

The main thing I would suggest that there are other data structures besides basic arrays.  In this case, a vector of pairs would work well.

std::vector&lt;std::pair&lt;int,int&gt;&gt; results;

...

results.push_back(std::make_pair(input[a], input[b]));

...

if(results.size() == 0) 
{
    std::cout &lt;&lt; "No sum of integers found to equal desired total.\n";
}

...

for(int i = 0; i &lt; results.size(); ++i) 
{
    std::cout &lt;&lt; '(' &lt;&lt; results[i].first &lt;&lt; ", " &lt;&lt; results[i].second &lt;&lt; ')';


.
.
Style:
Always put brackets around your blocks, especially when there's a matching block that does have them (the if/else for showing the results).  

Give variables meaningful names, and don't re-use them just because they're the same type.  Also, you don't need to (and usually shouldn't) declare them all at the top of the method; declare them where they're used.

Separate the target number as its own variable, having it as the last item of the input array is less clear.

If you're not calling them anything more specific, i and j are the usual convention for loop variables.

The fake delay for "critical calculations" that in fact are already done is a bit silly. :P