Advertisement
NS2A2

Bài 2.1 C#

Dec 25th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.49 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Test
  8. {
  9.     class Member
  10.     {
  11.         public int MSV { get; set; }
  12.         public string Name { get; set; }
  13.         public int Age { get; set; }
  14.         public string Lop{ get; set;}
  15.  
  16.         public void InputInfo()
  17.         {
  18.             MSV = int.Parse(Console.ReadLine());
  19.             Name = Console.ReadLine();
  20.             Age = int.Parse(Console.ReadLine());
  21.             Lop = Console.ReadLine();
  22.         }
  23.         public void ShowInfo()
  24.         {
  25.             Console.WriteLine("MSV: " + MSV);
  26.             Console.WriteLine("Name: " + Name);
  27.             Console.WriteLine("Age: " + Age);
  28.             Console.WriteLine("Lop: " + Lop);
  29.         }
  30.     }
  31.     class HIT
  32.     {
  33.         public Member[] CLB { get; set; }
  34.         public int n {get;set;}
  35.         public void Input()
  36.         {
  37.             n = int.Parse(Console.ReadLine());
  38.             CLB = new Member[n];
  39.             for (int i = 0; i < n; i++)
  40.             {
  41.                 CLB[i] = new Member();
  42.                 CLB[i].InputInfo();
  43.             }
  44.         }
  45.         public void Output()
  46.         {
  47.             for (int i = 0; i < n; i++) CLB[i].ShowInfo();
  48.         }
  49.     }
  50.     class RunMain
  51.     {
  52.         static void Main(string[] args)
  53.         {
  54.             HIT a = new HIT();
  55.             a.Input();
  56.             a.Output();
  57.             Console.ReadKey();
  58.         }
  59.     }
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement