#include<stdio.h>
#include<conio.h>
#include<Windows.h>
const unsigned PER =225;
enum{Do=262,Re=294,Mi=330,Fa=392,So=392,La=440,Xi=494};
void Play(int f,int a,int t)
{
int i=0;
Beep((unsigned)(f*a),t*PER);
}
void Stop(int t)
{
Sleep(t*PER);
}
int main()
{
Play(Mi,2,2);Play(Mi,2,2); Play(Fa,2,2); Play(So,2,2);
Play(So,2,2);Play(Fa,2,2); Play(Mi,2,2); Play(Re,2,2);
Play(Do,2,2);Play(Do,2,2); Play(Re,2,2); Play(Mi,2,2);
Play(Mi,2,2);Play(Re,2,2); Play(Re,2,4);
Play(Mi,2,2);Play(Mi,2,2); Play(Fa,2,2); Play(So,2,2);
Play(So,2,2);Play(Fa,2,2); Play(Mi,2,2); Play(Re,2,2);
Play(Do,2,2);Play(Do,2,2); Play(Re,2,2); Play(Mi,2,2);
Play(Re,2,2);Play(Do,2,2); Play(Do,2,4);
Stop( 0 );
return 0;
原文地址:https://www.cnblogs.com/faith-txy/p/9902831.html
时间: 2024-10-04 05:59:21