Advertisement
RMarK0

Untitled

Dec 26th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.41 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace ConsoleApp19
  5. {
  6.     struct Sportsman
  7.     {
  8.         public uint[] Result;
  9.         public uint BestResult;
  10.         public string Name;
  11.         public Sportsman(uint[] result, string name)
  12.         { Result = result; Name = name; BestResult = result.Max(); }
  13.     }
  14.     class Program
  15.     {
  16.         static void Main(string[] args)
  17.         {
  18.             Sportsman[] sportsmen = new Sportsman[5];
  19.             Sportsman sp1 = new Sportsman(new uint[] { 190, 221, 199 }, "Johnson"); sportsmen[0] = sp1;
  20.             Sportsman sp2 = new Sportsman(new uint[] { 241, 217, 206 }, "Petrov"); sportsmen[1] = sp2;
  21.             Sportsman sp3 = new Sportsman(new uint[] { 206, 180, 214 }, "Sidorov"); sportsmen[2] = sp3;
  22.             Sportsman sp4 = new Sportsman(new uint[] { 140, 153, 171 }, "Brown"); sportsmen[3] = sp4;
  23.             Sportsman sp5 = new Sportsman(new uint[] { 230, 208, 214 }, "Bush"); sportsmen[4] = sp5;
  24.             Console.WriteLine("Фамилия \t         Лучший результат \t Результаты");
  25.             foreach (Sportsman sp in sportsmen)
  26.             {
  27.                 Console.Write($"{sp.Name}     \t {sp.BestResult}            \t ");
  28.                 foreach (uint spresult in sp.Result)
  29.                     Console.Write($"{spresult} ");
  30.                 Console.WriteLine();
  31.             }
  32.             Console.Read();
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement