Advertisement
kisame1313

Untitled

Jul 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main ( string [] args )
  6.     {
  7.         Tenant [] arr = new Tenant [5] ;
  8.  
  9.         arr [1] = new Tenant("pacan",10);
  10.  
  11.         Predicate<Tenant> tenant = FindTenant;
  12.  
  13.         Console.WriteLine (Array.FindLastIndex(arr,tenant));
  14.     }
  15.  
  16.     public static bool FindTenant ( Tenant ten )
  17.     {
  18.         return ten != null;
  19.     }
  20. }
  21.  
  22. class House
  23. {
  24.     ConsoleColor HouseColor;
  25.     string Adress;
  26.     int MaxTenants;
  27.     private Tenant [] Tenants;
  28.     public bool IsFull = false;
  29.  
  30.     public House ( ConsoleColor col, string adr, int max )
  31.     {
  32.         HouseColor = col;
  33.         Adress = adr;
  34.         MaxTenants = max;
  35.         Tenants = new Tenant [max];
  36.     }
  37.  
  38.     public void ShowAdress ( )
  39.     {
  40.         ConsoleColor defaultColor = Console.ForegroundColor;
  41.         Console.ForegroundColor = HouseColor;
  42.         Console.WriteLine (Adress);
  43.         Console.ForegroundColor = defaultColor;
  44.     }
  45.  
  46.     public void FillHouse ( params Tenant []  tenant)
  47.     {
  48.         //if ( Tenants.GetUpperBound (0) != Tenants.Length - 1 )
  49.         //{
  50.         //  int tensCount = Tenants.GetUpperBound ( 0 );
  51.         //  while ( !IsFull )
  52.         //  {
  53.         //      Tenants [tensCount] = tenant [tensCount];
  54.         //      if ( tensCount == tens.Length - 1 )
  55.         //      {
  56.         //          IsFull = true;
  57.         //          Console.WriteLine ( "Этот дом уже заполнен" );
  58.         //      }
  59.         //  }
  60.        
  61.         //}
  62.              
  63.         }
  64. }
  65.  
  66. class Tenant
  67. {
  68.     string Name;
  69.     byte Age;
  70.  
  71.     public Tenant (string name, byte age)
  72.     {
  73.         Name = name;
  74.         Age = age;
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement