#include //#include void fout( int [][8],int,int); main(){ int i,j,k,l; int temp[8][8]; int ada[8][8]={{ 1, 1, 1, 1, 1, 1, 1, 1},//0アダマール行列 {-1,-1,-1,-1, 1, 1, 1, 1},//1 {-1,-1, 1, 1, 1, 1,-1,-1},//2 { 1, 1,-1,-1, 1, 1,-1,-1},//3 { 1,-1,-1, 1, 1,-1,-1, 1},//4 {-1, 1, 1,-1, 1,-1,-1, 1},//5 {-1, 1,-1, 1, 1,-1, 1,-1},//6 { 1,-1, 1,-1, 1,-1, 1,-1}};//7 for(i=0;i<8;i++){ for(j=0;j<8;j++){ for(k=0;k<8;k++){ for(l=0;l<8;l++){ temp[k][l] = ada[i][l]*ada[j][k]; fout(temp,i,j); } } } } } void fout(int temp[][8],int u,int v){ FILE *fpout; char name[] = "out",kaku[]=".pgm"; char str[16]; int i,j; sprintf(str,"%s%d%d%s",name,u,v,kaku); // printf("%s",name); fpout = fopen(str,"w"); for(i=0;i<8;i++){ for(j=0;j<8;j++){ if(temp[i][j] <= 0){ temp[i][j] = 255; }else{ // temp[i][j] = 0; } } } fprintf(fpout,"P2\n8 8\n255\n"); for(i=0;i<8;i++){ for(j=0;j<8;j++){ fprintf(fpout,"%d ",temp[i][j]); } fprintf(fpout,"\n"); } fclose(fpout); }