Advertisement
jocarrillo

jornadas (C# Shell App Paste)

Sep 18th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.41 KB | None | 0 0
  1. //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
  2. using System;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Collections.Generic;
  6.  
  7. namespace CSharp_Shell
  8. {
  9. class team {
  10.     public string name;
  11. }
  12.  
  13. class match {
  14.     public int journey;
  15.     public team home;
  16.     public team visit;
  17. }
  18.  
  19.     public static class Program
  20.     {
  21.         static List<team> teams = new List<team>();
  22.         static List<match> matches = new List<match>();
  23.        
  24.         public static void Main()
  25.         {
  26.             var t1 = new team();
  27.             t1.name = "aguero";
  28.             teams.Add(t1);
  29.            
  30.             var t2 = new team();
  31.             t2.name = "andrestico";
  32.             teams.Add(t2);
  33.            
  34.             var t3 = new team();
  35.             t3.name = "bryanmarf";
  36.             teams.Add(t3);
  37.            
  38.             var t4 = new team();
  39.             t4.name = "vanhoorde";
  40.             teams.Add(t4);
  41.            
  42.             var t5 = new team();
  43.             t5.name = "royvilla";
  44.             teams.Add(t5);
  45.            
  46.             var t6 = new team();
  47.             t6.name = "alexcortes";
  48.             teams.Add(t6);
  49.            
  50.             var t7 = new team();
  51.             t7.name = "nazgulbd";
  52.             teams.Add(t7);
  53.            
  54.             var t8 = new team();
  55.             t8.name = "arielah";
  56.             teams.Add(t8);
  57.            
  58.             var t9 = new team();
  59.             t9.name = "andy22";
  60.             teams.Add(t9);
  61.            
  62.             var t10 = new team();
  63.             t10.name = "fambru";
  64.             teams.Add(t10);
  65.            
  66.             var t11 = new team();
  67.             t11.name = "jmoruas";
  68.             teams.Add(t11);
  69.            
  70.             var evenTeams = teams.Count() % 2;
  71.            
  72.             if (evenTeams != 0) {
  73.                var tFree = new team();
  74.                tFree.name = "Descansa Jornada";
  75.                teams.Add(tFree);
  76.             };
  77.        
  78.         var teamCount = teams.Count();
  79.        
  80.             for(int i=0; i<teamCount-1;i++){
  81.                 var newMatch = new match();
  82.                
  83.                 newMatch.journey = i+1;
  84.                 newMatch.home = teams.ToArray()[i];
  85.                 newMatch.away = teams.ToArray()[teamCount-1];
  86.                
  87.                 matches.Add(newMatch);
  88.             }
  89.            
  90.         foreach(var match in matches) {
  91.             Console.WriteLine("J" + match.journey + "-" + match.home + " vs " + match.visit);
  92.         };
  93.            Console.WriteLine("cantidad de equipos" + teams.Count().ToString());
  94.            Console.WriteLine("cantidad de partidos" + matches.Count().ToString());
  95.         }
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement