Difference between revisions of "DisplayWinner"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "The display winner shows the winner between any amount of players. '''Winner Winner Chicken Dinner''' <syntaxhighlight land="csharp"> private static void DisplayWinner(in...")
 
Line 1: Line 1:
 
The display winner shows the winner between any amount of players.   
 
The display winner shows the winner between any amount of players.   
  
'''Winner Winner Chicken Dinner'''
+
<syntaxhighlight lang="csharp">
 
 
 
 
<syntaxhighlight land="csharp">
 
 
private static void DisplayWinner(int PlayerOneScore, int PlayerTwoScore)
 
private static void DisplayWinner(int PlayerOneScore, int PlayerTwoScore)
 
         {
 
         {

Revision as of 12:15, 14 November 2017

The display winner shows the winner between any amount of players.

private static void DisplayWinner(int PlayerOneScore, int PlayerTwoScore)
        {
            Console.WriteLine();
            Console.WriteLine("**** GAME OVER! ****");
            Console.WriteLine();
            Console.WriteLine("Player One your score is " + PlayerOneScore);
            Console.WriteLine("Player Two your score is " + PlayerTwoScore);
            if (PlayerOneScore > PlayerTwoScore)
            {
                Console.WriteLine("Player One wins!");
            }
            else if (PlayerTwoScore > PlayerOneScore)
            {
                Console.WriteLine("Player Two wins!");
            }
            else
            {
                Console.WriteLine("It is a draw!");
            }
            Console.WriteLine();
        }