Advertisement
tutzy

Text Gravity

May 27th, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Problem_8___Text_Gravity
  9. {
  10.     class TextGravity
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int lengthMatrix = 10; //int.Parse(Console.ReadLine());
  15.             string input = "The Milky Way is the galaxy that contains our star system";//Console.ReadLine();
  16.             Console.WriteLine(input);
  17.             int col = 0;
  18.             for (int i = 0; i < input.Length; i++)
  19.             {
  20.                 col = input.Length / 10 + 1;
  21.             }
  22.  
  23.             char[,] inputToCharArray = new char[lengthMatrix, col];
  24.  
  25.             List<char> list = new List<char>();
  26.             char x ;
  27.             for (int i = 0; i < input.Length; i++)
  28.             {
  29.                x= input[i];
  30.  
  31.                 foreach (var item in list)
  32.                 {
  33.                     list.Add(x);
  34.                 }
  35.             }
  36.                // Console.WriteLine(x);
  37.            
  38.                 for (int p = 0; p < inputToCharArray.GetLength(0); p++)
  39.                 {
  40.  
  41.                     for (int j = 0; j < inputToCharArray.GetLength(1); j++)
  42.                     {
  43.                         inputToCharArray[p, j] = ;    // ей тука незнам какво да напиша                    
  44.                         Console.Write(inputToCharArray[p, j]);
  45.                     }
  46.                     Console.WriteLine();
  47.                 }
  48.             }
  49.  
  50.         }
  51.     }
  52.  
  53.  
  54.  
  55.  
  56. //string pattern = @"\s+";                                                    // remuve empty spaces                                                    //Regex regex = new Regex(pattern);
  57. //string result = regex.Replace(input, "");
  58. //Console.WriteLine(result);
  59.  
  60.  
  61. //char[] inputToCharArray = input.ToCharArray();                             // with char array
  62. //for (int i = 0; i < inputToCharArray.Length; i++)
  63. //{
  64. //    char tempLetter = inputToCharArray[i];
  65.  
  66. //    if(inputToCharArray[i]==' ')
  67. //    {
  68. //        tempLetter = inputToCharArray[i+1];
  69. //        Console.Write(tempLetter);
  70. //    }
  71. //}
  72.  
  73.  
  74. //    }
  75. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement