Level 5 - One-dimension arrays and lists 0 of 9 activities solved
  1. RPG inventory Not yet solved
  2. Search for life Not yet solved
  3. Two-dice pig Not yet solved
  4. Random name generator Not yet solved
  5. Cup draw Not yet solved
  6. Feud Not yet solved
  7. Darts Not yet solved
  8. Cut the deck Not yet solved
  9. London underground Not yet solved
Next series Level 6 - Count controlled iterations and scope
Level 5 - One-dimension arrays and lists

Cup draw

Sign in to hand in your solution and get feedback.

// Cup draw program using System; using System.Collections.Generic; class Submission { // ------------------------- // Globals // ------------------------- static Random random_generator = new Random(); // ------------------------- // Subprograms // ------------------------- // Add teams to a list in pairs static void input_teams(List<string> teams) { } // Shuffle (Fisher-Yates) static void shuffle(List<string> list) { int n = list.Count; while (n > 1) { n--; int i = random_generator.Next(n + 1); string value = list[i]; list[i] = list[n]; list[n] = value; } } // Draw teams to play each other randomly static void draw_teams(List<string> teams) { } // ------------------------- // Main program // ------------------------- public static void Main(string[] args) { List<string> teams = new List<string>(); input_teams(teams); draw_teams(teams); } }