#include unistd.h // 頭文件
成都創(chuàng)新互聯(lián)公司網(wǎng)站建設(shè)服務(wù)商,為中小企業(yè)提供成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè)服務(wù),網(wǎng)站設(shè)計,成都網(wǎng)站托管等一站式綜合服務(wù)型公司,專業(yè)打造企業(yè)形象網(wǎng)站,讓您在眾多競爭對手中脫穎而出成都創(chuàng)新互聯(lián)公司。
int usleep(useconds_t usec); // 函數(shù)原型
usec -- 毫秒。整數(shù)。最大允許值:小于 1000000
返回 0 -- 表示調(diào)用執(zhí)行成功,1 -- 失敗。
是發(fā)聲函數(shù),運行后通過主板喇叭唱出旋律,可以試試下面:
TC 試:
#includedos.h
#includeconio.h
#includestdlib.h
/* this founction plays sound until hit any key */
void mysound()
{
long freq ;
while(!kbhit()){/* while no keyboard hit, play sound */
for(freq=200L;freq2000L;freq+=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 試驗上兩個。
用 Beep 函數(shù),參數(shù)1是頻率,參數(shù)2是時間長度。
下面唱 多來米發(fā)少啦西多......
MS VC++ 6.0 編譯器
#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);
Beep(880,500);
Beep(980,500);
Beep(1060,500);
Sleep(500);
Beep(523,500);
Beep(587,500);
Beep(659,500);
Beep(698,500);
Beep(784,500);
}
是發(fā)聲函數(shù),運行后通過主板喇叭唱出旋律,可以試試下面:
TC 試:
#includedos.h
#includeconio.h
#includestdlib.h
/* this founction plays sound until hit any key */
void mysound()
{
long freq ;
while(!kbhit()){/* while no keyboard hit, play sound */
for(freq=200L;freq2000L;freq+=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 試驗上兩個。
網(wǎng)頁名稱:c語言beep函數(shù)怎么用,c語言beep函數(shù)音調(diào)
文章起源:http://chinadenli.net/article30/dsicipo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊、網(wǎng)站設(shè)計、、外貿(mào)建站、企業(yè)建站、電子商務(wù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)