Advertisement
kisame1313

Untitled

Jul 15th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. #region trololo
  2. using System;
  3.  
  4. namespace TestProgram
  5. {
  6.     class MyClass
  7.     {
  8.         static void Main ()
  9.         {
  10.             #endregion
  11.             string [] notes;
  12.  
  13.             Console.WriteLine ( "Введите количество записок" );
  14.             int notesCount = Convert.ToInt32 ( Console.ReadLine () );
  15.  
  16.             notes = new string [notesCount];
  17.  
  18.             for ( int i = 0 ; i < notes.Length ; i++ )
  19.             {
  20.                 notes [i] = Console.ReadLine ();
  21.             }
  22.  
  23.             Console.Clear ();
  24.             Console.ForegroundColor = ConsoleColor.Green;
  25.             for ( int i = 0 ; i < notes.Length ; i++ )
  26.             {
  27.                 Console.WriteLine (notes[i].PadLeft(MaxLength(notes), '#') );
  28.             }
  29.         }
  30.  
  31.         static int MaxLength ( string [] arr )
  32.         {
  33.             string tempStr = arr [0];
  34.             for ( int i = 0 ; i < arr.Length ; i++ )
  35.             {
  36.                 if ( arr [i].Length < tempStr.Length )
  37.                 {
  38.                 }
  39.                 else
  40.                 tempStr = arr [i];
  41.             }
  42.             return tempStr.Length;
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement