List

Run Settings
LanguageC#
Language Version
Run Command
using System; using System.Collections.Generic; class MainClass { static void Main() { List<List<int>> x = new List<List<int>>(); int[,] b = {{0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,1,0,0,0,0}, {0,0,0,0,1,1,1,0,0,0}, {0,0,0,0,0,1,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}}; for(int i = 0; i < b.GetLength(0); i ++) { x.Add(new List<int>()); } int y = 1; foreach(int i in b) { x[(y-1)].Add(i); if(y++ % b.GetLength(0) == 0) { y = 1; } } y = 1; foreach(List<int> i in x) { foreach(int c in i) { Console.Write(c+" "); if(y++ % x.Count == 0) Console.WriteLine(""); } } Console.WriteLine("--------------------------------------------------------"); x.Add(new List<int>()); for(int w = 0; w < x[1].Count; w ++) x[x.Count-1].Add(0); for(int w = 0; w < x.Count; w ++) { x[w].Add(0); } y = 1; foreach(List<int> i in x) { foreach(int c in i) { Console.Write(c+" "); if(y++ % x[1].Count == 0) Console.WriteLine(""); } } Console.WriteLine("\n"+x.Count+"\t"+x[0].Count);//row, col;/- int f = 3; while(f != 0) { Console.WriteLine("A"); --f; } } }
Editor Settings
Theme
Key bindings
Full width
Lines