Advertisement
stefanpu

3D Lines Input

Feb 4th, 2013
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1.    private static void ReadCuboid()
  2.         {
  3.             // Read the cuboid size
  4.             string cuboidSize = Console.ReadLine();
  5.             string[] sizes = cuboidSize.Split();
  6.             width = int.Parse(sizes[0]);
  7.             height = int.Parse(sizes[1]);
  8.             depth = int.Parse(sizes[2]);
  9.             cuboid = new char[width, height, depth];
  10.  
  11.             // Read the cuboid data
  12.             for (int h = 0; h < height; h++)
  13.             {
  14.                 string line = Console.ReadLine();
  15.                 string[] letters = line.Split();
  16.                 for (int d = 0; d < depth; d++)
  17.                 {
  18.                     for (int w = 0; w < width; w++)
  19.                     {
  20.                         cuboid[w, h, d] = letters[d][w];
  21.                     }
  22.                 }
  23.             }
  24.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement