Using time function to make Sound ?

Hello everyone,,


I'm confused about this question! Please, I need your help ..



Q: Use the time function to generate 5 Beeps every 10 Seconds for 3 Times.



Thank you in advance.
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>       // std::cout, std::endl
#include <thread>         // std::this_thread::sleep_for
#include <chrono>         // std::chrono::seconds

void f(){
 for (int i=0; i<5;i++) {
    std::cout << '\a';
    std::this_thread::sleep_for (std::chrono::seconds(2));
  }
}

int main()
{
for(int j=0;j<3;j++)
 {
     f();
 }

  return 0;
}
Last edited on
when you highlight everything, you miss the important parts
"every 10 seconds"

you'll make the wait (silence), not the sound.
Topic archived. No new replies allowed.