#include <stdio.h> main() { int a[3]={1,2,3},i,j,k; FILE *fp=fopen("a.txt","w"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { for(k=0;k<3;k++) fprintf(fp,"%d%d%d\n",a[i],a[j],a[k]); } fprintf(fp,"\n"); } fclose(fp); }
时间: 2024-10-25 19:38:35
#include <stdio.h> main() { int a[3]={1,2,3},i,j,k; FILE *fp=fopen("a.txt","w"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { for(k=0;k<3;k++) fprintf(fp,"%d%d%d\n",a[i],a[j],a[k]); } fprintf(fp,"\n"); } fclose(fp); }