我有一个程序:
main()
{int n,a1[9],a2[9],a3[9],a4[9],a5[9],a6[9],a7[9],a8[9],a9[9],i1,i2,i3,i4,i5,i6,i7,i8,i9;
for(n=1;n<10;n++)
a1[n]=a2[n]=a3[n]=a4[n]=a5[n]=a6[n]=a7[n]=a8[n]=a9[n]=n;
for(i1=1;i1<10;i1++)
for(i2=1;i2<10;i2++)
for(i3=1;i3<10;i3++)
for(i4=1;i4<10;i4++)
for(i5=1;i5<10;i5++)
for(i6=1;i6<10;i6++)
for(i7=1;i7<10;i7++)
for(i8=1;i8<10;i8++)
for(i9=1;i9<10;i9++)
if ((int)(a1[i1]/3.5)!=(int)(a2[i2]/3.5) && (int)(a2[i2]/3.5)!=(int)(a3[i3]/3.5) && (int)(a3[i3]/3.5)!=(int)(a1[i1]/3.5) &&
(int)(a4[i4]/3.5)!=(int)(a5[i5]/3.5) && (int)(a5[i5]/3.5)!=(int)(a6[i6]/3.5) && (int)(a6[i4]/3.5)!=(int)(a4[i4]/3.5) &&
(int)(a7[i7]/3.5)!=(int)(a8[i8]/3.5) && (int)(a8[i8]/3.5)!=(int)(a9[i9]/3.5) && (int)(a9[i9]/3.5)!=(int)(a7[i7]/3.5) &&
(a1[i1]%3)!=(a4[i4]%3) && (a4[i4]%3)!=(a7[i7]%3)&&(a7[i7]%3)!=(a1[i1]%3) &&
(a2[i2]%3)!=(a5[i5]%3) && (a5[i5]%3)!=(a8[i8]%3)&&(a8[i8]%3)!=(a2[i2]%3) &&
(a3[i3]%3)!=(a6[i6]%3) && (a6[i6]%3)!=(a9[i9]%3)&&(a9[i9]%3)!=(a3[i3]%3))
printf("/n%d,/n%d,/n%d,/n%d,/n%d,/n%d,/n%d,/n%d,/n%d",a1[i1],a2[i2],a3[i3],a4[i4],a5[i5],a6[i6],a7[i7],a8[i8],a9[i9]);
getch();
}
运行的结果不会保存为.txt格式,请高手指教,还需要加点什么语句使之运行的结果能保存为.txt格式的呢?
非常感谢!!