i need a program that set the clock to 00:00:00 if the user not enter the clock
then the program should count the time and print it on the screen until reach the user input

for example:
the time is 12:44:6 a.m.
and the user enter 4:3:50 a.m. to wake up
the program should count and print the clock from 12:44:6 a.m. until 4:3:50 a.m.

the output as follow


i really want your help


this might b helpfut for you

/* clock example: countdown */
#include <stdio.h>
#include <time.h>

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

int main ()
  int n;
  printf ("Starting countdown...\n");
  for (n=10; n>0; n--)
    printf ("%d\n",n);
    wait (1);
  printf ("FIRE!!!\n");
  return 0;

>this might b helpfut for you
Perhaps if your program is the only one running on the machine. A busy loop like the one in your wait function is a terrible CPU hog. Seeing as how the OP's program really only does two trivial things once per second (print the time and check if it needs to stop), there's a ton of wasted effort on doing nothing.

A much better option is to use a system-specific solution to pause the thread/process so that other programs can do something in the intervening time. For example:

#include <iostream>
#include <windows.h>

int main()
  while ( true ) {
    std::cout<<"One second has passed\n";
    Sleep ( 1000 );
This article has been dead for over six months. Start a new discussion instead.