C# Console.Beep

talentzemin發表於2024-05-10
using System;

namespace ConsoleApp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var hz = new[] { 392, 392, 440, 392, 523, 494, 392, 392, 440, 392, 587, 523, 392, 392, 784, 659, 523, 494, 440, 698, 698, 659, 523, 587, 523 };
            var time = new[] { 375, 125, 500, 500, 500, 1000, 375, 125, 500, 500, 500, 1000, 375, 125, 500, 500, 500, 500, 1000, 375, 125, 500, 500, 500, 1000 };
            for (int i = 0; i < 25; i++)
            {
                Console.Beep(hz[i], time[i]);
            }
            Console.ReadKey();
        }
    }
}