1 #include<stdio.h> 2 int main(){ 3 int pImg[101];//原图像 4 int pImg1[101]; //目标图像 5 int nWidth = 10;//图像宽高。为方阵 6 for(int i=0;i<100;i++){ 7 pImg[i] = i; 8 } 9 for(int mj=0;mj<nWidth;mj++){ 10 for(int mi=0;mi<nWidth;mi++){ 11 //顺时针90度pImg1[mi*nWidth+(nWidth-mj-1)] = pImg[mj*10+mi]; 12 //逆时针90度pImg1[(nWidth-mi-1)*10+mj] = pImg[mj*10+mi]; 13 //时针旋转180度pImg1[(nWidth-mj-1)*nWidth+(nWidth-mi-1)] = pImg[mj*10+mi]; 14 //顺时针旋转180度pImg1[(nWidth-mj-1)*nWidth+mi] = pImg[mj*10+mi]; 15 } 16 } 17 for(int i=0;i<nWidth;i++){ 18 for(int j=0;j<nWidth;j++){ 19 printf("%d ",pImg[i*10+j]); 20 } 21 printf("\\n"); 22 } 23 }