for (t = 0; t < 10; ++t)

{

for (i = 0; i < 10; ++i)

since you take in the value for size, you might as well use it here for 10.

Printable View

- 03-03-2002Betazep
for (t = 0; t < 10; ++t)

{

for (i = 0; i < 10; ++i)

since you take in the value for size, you might as well use it here for 10. - 03-03-2002Betazep
Problem now, it keeps looping.

realize that it is going to say something ~100 times with way you have it set up.

pull the "sorry...." outside of the loop like this

Code:`for (t = 0; t < 10; ++t)`

{

for (i = 0; i < 10; ++i)

{

if (array[t] + array[i] == 100)

{

cout << "The numbers equal 100.\n";

set = 1;

}

}

if (set==1)

cout << "Sorry, I cannot find 2 numbers whose sum is 100.\n";

}

- 03-03-2002Betazep
or even better

Code:`int set=0;`

for (t = 0; t < 10; ++t)

{

for (i = 0; i < 10; ++i)

{

if (array[t] + array[i] == 100)

{

cout << "The numbers equal 100.\n";

set++;

}

}

if (set==0)

cout << "Sorry, I cannot find 2 numbers whose sum is 100.\n";

else

cout << "Found " << set << " sets of numbers whose sum is 100\n."

}

I will leave you to the rest.... - 03-03-2002CindyLouThanks Betazep
I'm getting closer...you've been a great help. I appreciate it.

- 03-03-2002Betazep
A final hint on the problem of calculating the value of the same number if it equals 50...

if/then hint: if number 1 is equal to number 2 then it is the same array position... or rather if number 1 is not equal to number 2 then perform desired operation - 03-03-2002CindyLougot it
thanks betazep, i figured that one out. my only issue now is, I only want it to print one message or the other, not both. everything else checks out - got rid of double hits (two hits on same set of #'s) etc. Think I have the last problem figured out, going to try it now (fingers crossed!).