TC 试:
#include<dos.h>
#include<conio.h>
#include<stdlib.h>
/* this founction plays sound until hit any key */
void mysound()
{
long freq
while(!kbhit()){/* while no keyboard hit, play sound */
for(freq=200Lfreq<2000Lfreq+=200L){
sound(freq)/*play freq sound*/
delay(200)/*delay 200ms*/
}
}
nosound()/* stop playing */
}
void main()
{
mysound()
}
---------------
VC++ 试:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
main()
{
Beep(523,500)
Beep(587,500)
Beep(659,500)
Beep(698,500)
Beep(784,500)
Sleep(500)
Beep(523,500)
Beep(587,500)
Beep(659,500)
Beep(698,500)
Beep(784,500)
}
------
wintc 试验上两个。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)