functions sound/delay/nosound in dos.h for c/c++

岁酱吖の 提交于 2019-12-29 09:23:15

问题


How can I get a version of language C/C++(downloaded??) where the functions sound, nosound, delay are present in the library DOS.H? For example it doesn't exist in the version c/c++ on code::blocks. What have I to do in order to use/find the functions sound/nosound/delay? thank you for your help !


回答1:


In Windows programs you may use win32 functions:

  • Sleep() as a replacement for delay()
  • Beep() as a replacement for a combination of sound() + delay() + nosound().



回答2:


download (sigh) a copy of TurboC/TurboC++.




回答3:


if u r having above win 7,, Download borland Turbo c++ using dos box to listen to a beep for 500 miliseconds, use the following code,

#include<iostream.h>
#include<conio.h>
#include<dos.h>
void main()
{clrscr();  //for clearing the screen...
int x;
x=1000;         // here 1000 is the frequency of the sound 
sound(x);       //u can directly write integer in the place of x
delay(500);
nosound();      //it is necessary to close the sound or u will keep on hearing

getch();        // to wait at the end of program
}


来源:https://stackoverflow.com/questions/13001650/functions-sound-delay-nosound-in-dos-h-for-c-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!