Difference between revisions of "Display - AS 2017"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "==The Code== <syntaxhighlight lang=Csharp> </syntaxhighlight> ==Explanation==")
 
 
Line 2: Line 2:
  
 
<syntaxhighlight lang=Csharp>
 
<syntaxhighlight lang=Csharp>
 
+
static void Display(char[,] Field, string Season, int Year)
 +
{
 +
    Console.WriteLine("Season: " + Season + " Year number: " + Year);
 +
    for (int Row = 0; Row < FIELDLENGTH; Row++)
 +
    {
 +
        for (int Column = 0; Column < FIELDWIDTH; Column++)
 +
        {
 +
            Console.Write(Field[Row, Column]);
 +
        }
 +
        Console.WriteLine("| " + String.Format("{0,3}", Row));
 +
    }
 +
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
==Explanation==
 
==Explanation==

Latest revision as of 09:28, 3 March 2017

The Code

static void Display(char[,] Field, string Season, int Year)
{
    Console.WriteLine("Season: " + Season + " Year number: " + Year);
    for (int Row = 0; Row < FIELDLENGTH; Row++)
    {
        for (int Column = 0; Column < FIELDWIDTH; Column++)
        {
            Console.Write(Field[Row, Column]);
        }
        Console.WriteLine("| " + String.Format("{0,3}", Row));
    }
}

Explanation