Is there a reliable, cross-platform way to pause a program for a set amount of time? The getch() function will wait for user input, but I would like to be able to pause for say 3 seconds. If a for loop is used like so:

#include <iostream>
using namespace std;

int main()
     for(i = 0, i < 10000, i++)
     return 0;

There will be no garuntee that on a machine running a quad-core the code will always pause for 3 seconds.

Is there an easy way to time using <ctime>? I saw AncientDragons' post about subtracting the system start time from the current time and that could be used, but is there an easier way?

9 Years
Discussion Span
Last Post by Ancient Dragon
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.