Advertisement
RMarK0

Untitled

Dec 26th, 2019
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.75 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. using System.IO;
  7.  
  8. namespace ConsoleApp19
  9. {
  10.     class Sportsman
  11.     {
  12.         public uint[] Result;
  13.         public uint BestResult;
  14.         public string Name;
  15.         public Sportsman(uint[] result, string name)
  16.         { Result = result; Name = name; BestResult = result.Max(); }
  17.     }
  18.     class Program
  19.     {
  20.         static void Main(string[] args)
  21.         {
  22.             string path = @"G:\surnames.txt";
  23.             StreamReader sr = new StreamReader(path, Encoding.GetEncoding(1251));
  24.             Sportsman[] sportsmen = new Sportsman[5];
  25.             Sportsman sp1 = new Sportsman(new uint[] { 190, 221, 199 }, sr.ReadLine()); sportsmen[0] = sp1;
  26.             Sportsman sp2 = new Sportsman(new uint[] { 241, 217, 206 }, sr.ReadLine()); sportsmen[1] = sp2;
  27.             Sportsman sp3 = new Sportsman(new uint[] { 206, 180, 214 }, sr.ReadLine()); sportsmen[2] = sp3;
  28.             Sportsman sp4 = new Sportsman(new uint[] { 140, 153, 171 }, sr.ReadLine()); sportsmen[3] = sp4;
  29.             Sportsman sp5 = new Sportsman(new uint[] { 230, 208, 214 }, sr.ReadLine()); sportsmen[4] = sp5;
  30.             Console.ForegroundColor = ConsoleColor.Cyan;
  31.             Console.WriteLine(" Фамилия \t Лучший результат \t   Результаты");
  32.             Console.ResetColor();
  33.             foreach (Sportsman sp in sportsmen)
  34.             {
  35.                 Console.Write($"{sp.Name}     \t {sp.BestResult}            \t ");
  36.                 foreach (uint spresult in sp.Result)
  37.                     Console.Write($"{spresult} ");
  38.                 Console.WriteLine();
  39.             }
  40.             Console.Read();
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement