小蜜蜂

網路抄來的,有用到Windows API。




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
功能:以主機喇叭播放小蜜蜂。
*/

#include<windows.h>
#include<conio.h>

int main()
{
    int row,col;
    int voice[16][4]={{700,600,600,0},{650,550,550,0},{500,550,600,650},{700,700,700,0},
                    {700,600,600,0},{650,550,550,0},{500,650,700,700},{600,0,0,0},
                    {550,550,550,550},{550,600,650,0},{600,600,600,600},{600,650,700,0},
                    {700,600,600,0},{650,550,550,0},{500,600,700,700},{500,0,0,0}} ; 
    int tempo[16][4]={{1,1,2,0},{1,1,2,0},{1,1,1,1},{1,1,2,0},
                    {1,1,2,0},{1,1,2,0},{1,1,1,1},{4,0,0,0},
                    {1,1,1,1},{1,1,2,0},{1,1,1,1},{1,1,2,0},
                    {1,1,2,0},{1,1,2,0},{1,1,1,1},{4,0,0,0}}; 
    for (row=0; row<16; row++)
    {
        for (col=0; col<4; col++)
        {
            Beep(voice[row][col],tempo[row][col]*350);           
        }
    }         
 return 0;
}  

No response to “小蜜蜂” ;

張貼留言