Hey guys,
I'm trying to write a program in C++ that breaks when it find suitable numbers for a, b, c, d, e, f, g, h, and i through nested for loops, but for some reason it's not working properly. There's a series of mathematical operations that these 9 ints needs to enter and none of them can equal each other (a through i = an int 1-9 where no ints are repeated).
It seems to run the equation check OK (it breaks when the function ==100), but it doesn't run the variable check correctly for some reason, it spits out lots of numbers that are similar to each other, and I don't know why. When I run tests outside of these for loops with similar approaches they work fine, but not inside for some reason. Halp.
running the if statement
if ((sum==100)&&(a!=b!=c!=d!=e!=f!=g!=h!=i))
{
cout << output;
break;
}
Which works outside of the for loops, but inside it seems to ignore the whole integers equaling each other part.
I'm trying to write a program in C++ that breaks when it find suitable numbers for a, b, c, d, e, f, g, h, and i through nested for loops, but for some reason it's not working properly. There's a series of mathematical operations that these 9 ints needs to enter and none of them can equal each other (a through i = an int 1-9 where no ints are repeated).
It seems to run the equation check OK (it breaks when the function ==100), but it doesn't run the variable check correctly for some reason, it spits out lots of numbers that are similar to each other, and I don't know why. When I run tests outside of these for loops with similar approaches they work fine, but not inside for some reason. Halp.
running the if statement
if ((sum==100)&&(a!=b!=c!=d!=e!=f!=g!=h!=i))
{
cout << output;
break;
}
Which works outside of the for loops, but inside it seems to ignore the whole integers equaling each other part.
Last edited by Bevo (2011-02-24 16:47:42)