Advertisement
Rodunskiy

Untitled

May 12th, 2025
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. namespace CSLight
  2. {
  3.     public class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             Player player = new Player("Родион", 25, 80);
  8.  
  9.             player.OutputInformation();
  10.         }
  11.     }
  12.  
  13.     class Player
  14.     {
  15.         public string Name;
  16.         public int Age;
  17.         public float Weight;
  18.  
  19.         public Player(string name, int age, float weight)
  20.         {
  21.             Name = name;
  22.             Age = age;
  23.             Weight = weight;
  24.         }
  25.  
  26.         public Player()
  27.         {
  28.             Name = "none";
  29.             Age = 0;
  30.             Weight = 0;
  31.         }
  32.  
  33.         public void OutputInformation()
  34.         {
  35.             Console.WriteLine($"Имя:{Name}\nВозраст:{Age}\nВес:{Weight}");
  36.         }
  37.     }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement