here is the solution posted by the prof.
A little more sophisticated than I thought.
Code:
#include <iostream>
using namespace std;
int main() {
int a[6], b[10];
int s=0, o, p, q;
bool match=false;
cout<<"Enter six integers between 1 and 1000"<<endl;
for (int i=0; i<=5; i++)
cin>>a[i];
for (int j=0; j<5; j++)
for (int k=j+1; k<5; k++)
for (int l=k+1; l<5; l++) {
b[s] = a[j]+a[k]+a[l];
if (b[s] == a[5]) {
o=j; p=k; q=l;
match = true;
}
s++;
}
if (match)
cout<<"MATCH found: "<<a[o]<<" + "<<a[p]<<" + "<<a[q]<<" = "<<a[5]<<endl;
else cout<<"NOT found. No combination adds up to "<<a[5]<<endl;
return 0;
}