How do you rotate a two dimensional array?

后端 未结 30 3137
耶瑟儿~
耶瑟儿~ 2020-11-22 02:43

Inspired by Raymond Chen\'s post, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I\'d

30条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 03:34

    For i:= 0 to X do For j := 0 to X do graphic[j][i] := graphic2[X-i][j]

    X is the size of the array the graphic is in.

提交回复
热议问题