Hello, Im trying to make some sort of reminder program that plays a wav every 30 seconds to remind me of what Im supposed to do.

#include <iostream.h>
int main()
{
     system("start alarm.wav");
     }

Thats what Ive got so far, now Im trying to figure out how to make it repeat every 30 seconds, but with no luck :(

iostream.h is outdated, use iostream.

seondly, use ctime (time.h) to get the current time then write a simple loop with some iteration in order to get it to repeat every x seconds

using ctime functions will consume a lot of CPU time. Instead its better to call the os Sleep() function (MS-Windows) or sleep() (*nix).

#include <iostream>
#include <windows.h>
int main()
{
    while(true) // infinite loop
    {
         system("start alarm.wav");
         Sleep(30 * 1000); // delay 30 seconds
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.