High Score -Udemy

PHOTO EMBED

Wed Jan 04 2023 16:12:00 GMT+0000 (Coordinated Universal Time)

Saved by @AlferM #c#

using System;
using System.Xml.Linq;

namespace ConsoleApp1
{
    internal class Program
    {
        static int highScore = 50;
        static string highScoreHolder = "Alfer";

        public static void Main(string[] args)
        {
            PlayerScore(45,"Rumaiz");
            PlayerScore(55,"zahidh");
            PlayerScore(60,"Mohamed");
        }

        public static void PlayerScore(int score, string player) {
            if (score > highScore)
            {
                highScore = score;
                highScoreHolder = player;

                Console.WriteLine("New high score is: " + score + " New record holder is: " + player);
            }
            else 
            {
                Console.WriteLine("High score is: "+highScore+" was not broken & The record holder is: "+highScoreHolder);
            }
        }
    }
}
content_copyCOPY