當前位置:編程學習大全網 - 編程軟體 - 矩陣旋轉編程

矩陣旋轉編程

bool rotate90(int arraySrc[],int arrayDes[],int rows,int cols)

{

for(int I = 0;我& lt行;i++)

for(int j = 0;j & ltcolsj++)

arrayDes[j * rows+(rows-I-0)]= arraySrc[I * cols+j]

}

bool rotate 180(int arraySrc[],int arrayDes[],int rows,int cols)

{

for(int I = 0;我& lt行;i++)

for(int j = 0;j & ltcolsj++)

arrayDes[(rows-I-1)* cols+(cols-j-1)]= arraySrc[I * cols+j]

}

bool rotate270(int arraySrc[],int arrayDes[],int rows,int cols)

{

for(int I = 0;我& lt行;i++)

for(int j = 0;j & ltcolsj++)

arrayDes[(cols-j-1)* rows+I]= arraySrc[I * cols+j]

}

  • 上一篇:想買個繪圖的筆記本電腦怎麽選擇,
  • 下一篇:車床潤滑方法都有什麽要求?
  • copyright 2024編程學習大全網