在<windows.h>中
一:BOOL WINAPI MessageBeep (_in UINT uType );
播放一个波形文件 (也就是wac格式),每个声音类型的波形声音在注册表中有一个条目 (entry ) 指定
如MB_OK
二:BOOL WINAPI BEEP (
_in DWORD dwFreq, //频率
_in DWORD dwDuration //毫秒
);
G 调:G A B C D E #F G
C 调:C D E F G A B
E 调:E #F #G A B #C #D
#include <windows.h> #include <cstdio> #define TIME 1000 int main () { printf(" 起来!不愿做奴隶的人们! 把我们的血肉筑成我们新的长城! 中华民族到了最危险的时候, 每个人被迫着发出最后的吼声。 起来!起来!起来! 我们万众一心, 冒着敌人的炮火,前进! 冒着敌人的炮火,前进! 前进!前进、进! "); printf("向伟大的祖国致敬 作者YaoLin_X 不得盗用本人的作品以做违法《国歌法》的事 若不听劝阻,承担法律责任,本人不负任何责任 默认用户已经同意"); Beep(294,TIME/2 ); Beep(392,TIME*3/2); Beep(392,TIME/2 ); Beep(392,TIME*3/4); Beep(392,TIME/4 ); Beep(294,TIME/2 ); Beep(330,TIME/4 ); Beep(349,TIME/4 ); Beep(392,TIME ); Beep(392,TIME ); Sleep(TIME/2 ); Beep(494,TIME/2 ); Beep(392,TIME/2 ); Beep(440,TIME/4 ); Beep(494,TIME/4 ); Beep(587,TIME ); Beep(587,TIME ); Beep(494,TIME*3/4); Beep(494,TIME/4 ); Beep(392,TIME*3/4); Beep(494,TIME/4 ); Beep(587,TIME*3/4); Beep(494,TIME/4 ); Beep(440,TIME ); Beep(440,TIME*2 ); Beep(659,TIME ); Beep(587,TIME ); Beep(440,TIME ); Beep(494,TIME ); Beep(587,TIME/2 ); Beep(494,TIME/2 ); Sleep(TIME/2 ); Beep(587,TIME/2 ); Beep(494,TIME/2 ); Beep(440,TIME/4 ); Beep(494,TIME/4 ); Beep(392,TIME ); Beep(494,TIME ); Sleep(TIME ); Beep(294,TIME*3/4); Beep(330,TIME/4 ); Beep(392,TIME/2 ); Beep(392,TIME/2 ); Beep(494,TIME*3/4); Beep(494,TIME/4 ); Beep(587,TIME/2 ); Beep(587,TIME/2 ); Beep(440,TIME/2 ); Beep(440,TIME/4 ); Beep(440,TIME/4 ); Beep(330,TIME ); Beep(440,TIME*3/2); Beep(294,TIME/2 ); Beep(392,TIME*3/2); Beep(392,TIME/2 ); Beep(494,TIME*3/2); Beep(494,TIME/2 ); Beep(587,TIME*2 ); Beep(392,TIME*3/4); Beep(494,TIME/4 ); Beep(587,TIME/2 ); Beep(587,TIME/2 ); Beep(659,TIME ); Beep(587,TIME ); Beep(494,TIME*3/4); Beep(392,TIME/4 ); Beep(587,TIME/3 ); Beep(587,TIME/3 ); Beep(587,TIME/3 ); Beep(494,TIME/2 ); Sleep(TIME/2 ); Beep(392,TIME/2 ); Sleep(TIME/2 ); Beep(294,TIME ); Beep(392,TIME ); Beep(494,TIME*3/4); Beep(392,TIME/4 ); Beep(587,TIME/3 ); Beep(587,TIME/3 ); Beep(587,TIME/3 ); Beep(494,TIME/2 ); Sleep(TIME/2 ); Beep(392,TIME/2 ); Sleep(TIME/2 ); Beep(294,TIME ); Beep(392,TIME ); Beep(294,TIME ); Beep(392,TIME ); Beep(294,TIME ); Beep(392,TIME ); Beep(392,TIME ); return 0; }