repl.it
@kironroy/

multi_dim_array

C#

No description

fork
loading
Files
  • main.cs
  • main.exe
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;

class MainClass {
  public static void Main (string[] args) 
  {
        UnitedKingdomAndSomeCities();

  }

  private static void UnitedKingdomAndSomeCities()
        {
            // United Kingdom of Great Britain and Northern Ireland multi-dim array

            string[,] unitedKingdom = new string[4, 4];

            // England 
            string manchester = unitedKingdom[0, 0] = "Manchester";

            string london = unitedKingdom[0, 1] = "London";

            string liverpool = unitedKingdom[0, 2] = "Liverpool";

            string leeds = unitedKingdom[0, 3] = "Leeds";

            // Wales
            string cardiff = unitedKingdom[1, 0] = "Cardiff";

            string swansea = unitedKingdom[1, 1] = "Swansea";

            string newport = unitedKingdom[1, 2] = "Newport";

            string barry = unitedKingdom[1, 3] = "Barry";

            // Scotland
            string edinburgh = unitedKingdom[2, 0] = "Edinburgh";

            string glasgow = unitedKingdom[2, 1] = "Glasgow";

            string abeerdeen = unitedKingdom[2, 2] = "Aberdeen";

            string dundee = unitedKingdom[2, 3] = "Dundee";

            // Northern Ireland
            string belfast = unitedKingdom[3, 0] = "Belfast";

            string londonberry = unitedKingdom[3, 1] = "Londonberry";

            string lisburn = unitedKingdom[3, 2] = "Lisburn";

            string bangor = unitedKingdom[3, 3] = "Bangor";

            string hasCities = "has these four cities: ";

            Console.WriteLine($" \n England {hasCities}{manchester}, {london}, {liverpool}, {leeds}.\n" +
                $"\n Wales {hasCities}{cardiff}, {swansea}, {newport}, {barry}.\n" +
                $"\n Scotland {hasCities}{edinburgh}, {glasgow}, {abeerdeen}, {dundee}.\n" +
                $"\n Northern Ireland {hasCities}{belfast}, {bangor}, {londonberry}, {lisburn}.\n");
        }
}