
14-Apr-2009, 03:05
|
 |
DC's digimon
|
|
Fecha de Ingreso: 20-July-2008
Ubicación: digital world
Mensajes: 274
Posts agradecidos: 47
Agradecido 53 veces en 41 posts
|
|
Re: ayuda urgente sobre programa c++
Bueno, lo probe pero lo malo es que no tiene para decimas de segundo :(
Código:
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
unsigned int tiempototal, tiempo, timefinal;
int h, m, s, h1, m1, s1;
cout << "Introduce el tiempo que deseas marcar (hh, mm, ss): ";
cin >> h >> m >> s;
tiempototal = h * 3600 + m * 60 + s;
tiempo = time( 0 );
timefinal = tiempo + tiempototal;
h = tiempo % (3600 * 24 ) /3600 + h * 3600;
m = ( tiempo % 3600 ) / 60+ m * 60;
s = tiempo % 60 + s;
while ( tiempo <= timefinal )
{
system( "CLS" );
h1 = h - tiempo % (3600 * 24 ) /3600;
m1 = m - ( tiempo % 3600 ) / 60;
s1 = s - tiempo % 60;
cout << h1 << ":" << m1 << ":" << s1 << endl;
tiempo = time( 0 );
}
system( "pause" );
return 0;
}
|