标签:style blog color ar for sp div 2014 on
/******************************************************************** @date 2014-10-22 @author Tiger @brief 语法 @details C#二维数组 ********************************************************************/ using System; class Demo { static void Main() { int[,] arr = new int[4, 4] { {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12},{13, 14, 15, 16}}; for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { Console.Write(arr[i, j] + " "); } Console.WriteLine(); } for (int i = 0; i < 4; ++i) { for (int j = i + 1; j < 4; ++j) { int nTemp = arr[i, j]; arr[i, j] = arr[j, i]; arr[j, i] = nTemp; } } for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { Console.Write(arr[i, j] + " "); } Console.WriteLine(); } Console.ReadLine(); } }
标签:style blog color ar for sp div 2014 on
原文地址:http://www.cnblogs.com/roronoa-zoro-zrh/p/4042244.html