2013年12月8日

【算法】顺时针打印矩阵

摘要: 题目:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字。例如:如果输入如下矩阵:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16则依次打印出数字1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5, 6, 7, 11, 10。第一种思路:代码转自网络,楼主整理了一下:void printMatrixInCircle(int matrix[5][5],unsigned int nRow,unsigned int nCol){ int upbound = 0, downbound = nRow - 1; int leftbou... 阅读全文

posted @ 2013-12-08 15:21 theCambrian.cpp 阅读(324) 评论(4) 推荐(0) 编辑

导航