Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- namespace CSharp_Shell
- {
- class team {
- public string name;
- }
- class match {
- public int journey;
- public team home;
- public team visit;
- }
- public static class Program
- {
- static List<team> teams = new List<team>();
- static List<match> matches = new List<match>();
- public static void Main()
- {
- var t1 = new team();
- t1.name = "aguero";
- teams.Add(t1);
- var t2 = new team();
- t2.name = "andrestico";
- teams.Add(t2);
- var t3 = new team();
- t3.name = "bryanmarf";
- teams.Add(t3);
- var t4 = new team();
- t4.name = "vanhoorde";
- teams.Add(t4);
- var t5 = new team();
- t5.name = "royvilla";
- teams.Add(t5);
- var t6 = new team();
- t6.name = "alexcortes";
- teams.Add(t6);
- var t7 = new team();
- t7.name = "nazgulbd";
- teams.Add(t7);
- var t8 = new team();
- t8.name = "arielah";
- teams.Add(t8);
- var t9 = new team();
- t9.name = "andy22";
- teams.Add(t9);
- var t10 = new team();
- t10.name = "fambru";
- teams.Add(t10);
- var t11 = new team();
- t11.name = "jmoruas";
- teams.Add(t11);
- var evenTeams = teams.Count() % 2;
- if (evenTeams != 0) {
- var tFree = new team();
- tFree.name = "Descansa Jornada";
- teams.Add(tFree);
- };
- var teamCount = teams.Count();
- for(int i=0; i<teamCount-1;i++){
- var newMatch = new match();
- newMatch.journey = i+1;
- newMatch.home = teams.ToArray()[i];
- newMatch.away = teams.ToArray()[teamCount-1];
- matches.Add(newMatch);
- }
- foreach(var match in matches) {
- Console.WriteLine("J" + match.journey + "-" + match.home + " vs " + match.visit);
- };
- Console.WriteLine("cantidad de equipos" + teams.Count().ToString());
- Console.WriteLine("cantidad de partidos" + matches.Count().ToString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement