// Using the clock() function
#include <iostream>
#include <ctime>
using namespace std;

void wait(int sec){
  clock_t end;
  end =  clock() + sec * CLOCKS_PER_SEC;
  while( clock() < end) {}
}

int main()
{
  int n;
  cout << "Starting countdown...\n";
  for (n=10; n>0; n--){
    cout << "n = " << n << endl;
    wait(1);  // wait one second after printing
  }

  cout << "done." << endl;
  return 0;
}
