I am in a cpp class, but i am messing around the program on my own, and I am looking for some commands. or at least a place that i can go to find commands that i want.
There are 2 questions that I currently have. When i started with coding (way back on QBASIC) there were 2 commands that it seems like should be somewhat universal. one was a wait function. IE, in a loop function a command that makes the program wait for time N before it continues.
The other is a sound function. not the beep function, but where you could play freaquency x for time y. Is there a command like that for cpp?
thanks in advance.
3 3277
for(i=0;i<=3000 ;i+=100)
{
sound(i);//producing sound with the frequency of i
sleep(3)// wait for 3 seconds... u can also use the delay functions// delay(300) means, it'll wait for 300 milliseconds
}
sound(i);//producing sound with the frequency of i
sleep(3)// wait for 3 seconds... u can also use the delay functions// delay(300) means, it'll wait for 300 milliseconds
Now in which library are these functions defined, because they're not part of the standard library... ?
You could write wait functions using the ctime library. Sounds are more OS specific, I think that in windows there is a Beep() function defined in the windows API.
oler1s 671
Recognized Expert Contributor
I am in a cpp class, but i am messing around the program on my own, and I am looking for some commands. or at least a place that i can go to find commands that i want.
You have shell commands. You do not have C++ "commands".
there were 2 commands that it seems like should be somewhat universal
You are mistaken, then.
The simplest "wait" functionality is to use a busy loop. But if you want to pause a program's functionality, almost always a busy loop is undesirable. It depends on the system to do this, but look for "sleep" and see how to implement it on your operating system.
The other is a sound function. not the beep function, but where you could play freaquency x for time y.
Beeping is simpler, but if you want actual input through the sound card, etc. that's more involved. Again, OS specific. So look it up for your respective platform.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Rasmus Grøndahl Olsen |
last post by:
I have tried to write a wait function but it seems like it will not brake
the while loop. I tried two different solutions.
Can anyone tell me what I am doing wrong, and come with another suggestion?
If I call the function like this: wait(500); it should wait 500ms right?
function wait(time) {
while(1){
setTimeout("break;",time);
}
}
|
by: SP |
last post by:
Hi,
I want to add wait cursor code whenever page is post back. Page may be
post back on my user control's or on change of dropdown or on click of any
button on page. so is there any common solution available that will provide
me mechanism to display wait cursor or wait image to user whenever page is
post back to server?
Thanks,
|
by: PJ6 |
last post by:
This is the only solution I've found to get a wait cursor document-wide:
function Busy()
{
if (document.all) for (var i=0;i < document.all.length; i++)
document.all(i).style.cursor = 'wait';
}
Sadly, for pages with a lot of elements, its performance is not acceptable.
|
by: Perecli Manole |
last post by:
I am having some strange thread synchronization problems that require me to
better understand the intricacies of Monitor.Wait/Pulse.
I have 3 threads. Thread 1 does a Monitor.Wait in a SyncLock block
protecting a resource. Thread 2 and 3 also have a SyncLock block protecting
the same resource and after executing some code in their blocks they both do
a Monitor.Pulse to hand of the locked resource back to thread 1.
While thread 1 has...
|
by: Adam Clauss |
last post by:
Documentation states that a call to Wait releases the lock, and will not
return until the lock is reacquired.
How do exceptions figure into this? Are they considered a form of "return"?
Example:
lock (someObj)
{
try
| |
by: stephen.durkin |
last post by:
I've gathered that javascript doesn't have a handy wait() function, so
I made the following function makeDelay() to make use of PHP's sleep(),
which then does the waiting, and responds with "done"...my problem is
that the javascript doesn't wait for makeDelay(seconds) to finish...?
makeDelay(5);
iDontWaitForNobody();
function makeDelay(seconds) {
|
by: nullstring |
last post by:
Hallo Leute,
gerade sitze ich vor dem problem, das ich eine
Klasse schreiben muss dir mir ne Wav datei vom mikro aufnimmt und
wieder abspielt.
Mein Problem ist nun, das mir meine callbackfunction nie ein
MM_WIM_DATA liefert
und augenscheinlich auch nix aufnimmt.
Tja und wie es halt so ist, bin ein newbie was Winprogrammierung
|
by: MrDeej |
last post by:
Hello guys!
I am trying to use trevors wait function on my odbc database for a countdown function. But this function is not stable as it sometimes dosent actually wait before launching next line of code
The database is a ODBC update database which is full automatic startup/shutdown but because i sometimes want to make som edits to it i want a countdown before it shutsdown with a "cancel shutdown" code.
Wait(1)...
|
by: nathanwb |
last post by:
I have the following php code, at the top I am pulling a piece of data from a query and I echo the results with no problem, I am using Ajax with this page as well and further down the page when I try to reference the same $radio it dosnt show anything.
Line 7 is where i get the current radio number assigned to the person that is loged in. and line 80 is where I try to use it again.
Thanks
<?
include('../application.php');...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |