Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp14
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- zagrajMelodie(1);
- zagrajMelodie(2);
- }
- static void zagrajMelodie(int numer)
- {
- if (numer == 1)
- {
- //star wars
- int[] melodia = { 440, 440, 440, 349, 523, 440, 349, 523, 440,
- 0, 659, 659, 659, 698, 523, 415, 349, 523, 440, 0, 880, 880, 440, 440, 880,
- 831, 784, 698, 740, 0, 622, 659, 415, 440, 523, 0, 440, 523, 440, 0 };
- int[] czasTrwania = { 500, 500, 500, 350, 150, 500, 350, 150,
- 650, 500, 500, 500, 500, 350, 150, 500, 350, 150, 650, 500, 500, 500, 350,
- 150, 500, 350, 150, 650, 150, 500, 150, 500, 150, 1000, 500, 350, 150, 500,
- 350, 150, 650 };
- for (int i = 0; i < melodia.Length; i++)
- {
- if (melodia[i] != 0)
- {
- Console.Beep(melodia[i], czasTrwania[i]);
- }
- else
- {
- // pauza
- System.Threading.Thread.Sleep(czasTrwania[i]);
- }
- }
- }
- else if (numer == 2)
- { //Mario Bros
- int[] melodia = { 659, 659, 0, 659, 0, 523, 659, 0, 784, 0,
- 392, 0, 523, 0, 392, 0, 330, 0, 440, 494, 0, 466, 0, 440, 0, 392, 659, 0, 784,
- 780, 0, 784, 0, 659, 0, 523, 587, 0, 494, 0, 523, 0, 392, 0, 330, 0, 440, 494,
- 0, 466, 0, 440, 0 };
- int[] czasTrwania = { 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 400, 200, 200, 200, 400, 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
- 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200 };
- for (int i = 0; i < melodia.Length; i++)
- {
- if (melodia[i] != 0)
- {
- Console.Beep(melodia[i], czasTrwania[i]);
- }
- else
- {
- // pauza
- System.Threading.Thread.Sleep(czasTrwania[i]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement