求解释啊,为何觉得IF没一点作用
程序代码:
//1-9 9个数字,33组合,第三个数为第二个的两倍,第一个的三倍 #include <iostream> using namespace std; void fun() { int one,two,three; int b[10]={0,0,0,0,0,0,0,0,0,0}; for(one=123;one<=333;one++) { three=3*one; two=2*one; if(one%10!=0&&one/10%10!=0&&one/100!=0&&two%10!=0&&two/10%10!=0&&two/100!=0&&three%10!=0&&three/10%10!=0&&three/100!=0) { b[(one%10)]=one%10; b[(one/100)]=one/100; b[((one/10)%10)]=((one/10)%10); b[(two%10)]=two%10; b[((two/10)%10)]=(two/10)%10; b[(two/100)]=two/100; b[(three%10)]=three%10; b[((three/10)%10)]=(three/10)%10; b[(three/100)]=three/100; if(b[0]==0&&b[1]==1&&b[2]==2&&b[3]==3&&b[4]==4&&b[5]==5&&b[6]==6&&b[7]==7&&b[8]==8&&b[9]==9) cout<<one<<" "<<two<<" "<<three<<" "<<"符合条件"<<endl; } } } int main() { fun(); return 0; }
请问下为何觉得IF条件没发挥作用,去掉IF,只是少了2组数据,这是什么情况哈?
还有在数组里,如果数组下标是0,减1会怎么样哈?
[ 本帖最后由 a99875984 于 2012-10-8 18:04 编辑 ]