Console을 통해 사용자가 수정한 비프음을 재생하기 위한 코드는 다음과 같습니다 -
예
using System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); Console.WriteLine("Beep sound through Console with frequence 1000 hertz and duration 500 milliseconds"); Console.Beep(1000, 500); } }
출력
이것은 다음과 같은 출력을 생성합니다 -
Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through Console Beep sound through Console with frequence 1000 hertz and duration 500 milliseconds
예
이제 다른 예를 살펴보겠습니다 -
using System; public class Demo { public static void Main(String[] args){ int freq = 1500; int duration = 1000; Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); Console.WriteLine("Beep sound through Console with frequency 1000 hertz and duration 500 milliseconds"); Console.Beep(1000, 500); Console.WriteLine("Playing Beep sound 10 times..."); for (int i = 1; i < 10; i++) Console.Beep(freq, duration); } }
출력
이것은 다음과 같은 출력을 생성합니다 -
Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through Console Beep sound through Console with frequency 1000 hertz and duration 500 milliseconds Playing Beep sound 10 times...