【C语言】 使用Beep() 函数 演奏歌曲
#include <windows.h> int main(){ while(1){ Beep(523, 200); Beep(523, 200); Beep(578, 400); Beep(523, 400); Beep(698, 400); Beep(659, 800); Beep(523, 200); Beep(523, 200); Beep(578, 400); Beep(523, 400); Beep(784, 400); Beep(698, 800); Beep(523, 200); Beep(523, 200); Beep(1046, 400); Beep(880, 400); Beep(698, 400); Beep(659, 400); Beep(578, 400); Beep(932, 200); Beep(932, 200); Beep(880, 400); Beep(698, 400); Beep(784, 400); Beep(698, 800); } }
Beep(频率,持续时间)
频率单位为Hz;
持续时间为ms;
需要头文件 <windows.h>