Reloj

Categorías: Lenguaje C++

   1 // reloj
   2 
   3 #include <iostream>
   4 #include <time.h>
   5 using namespace std;
   6 
   7 int main (){
   8   int h=0, m=0, s=0, prueba=0;
   9   cout <<"Inicialice el reloj\n";
  10   cout <<"hora ";
  11   cin >>h;
  12   cout <<"minuto ";
  13   cin >>m;
  14   cout <<"segundo ";
  15   cin >>s;
  16   for(int i=1;i>0;i++){
  17     cout <<h <<":" <<m <<":"<<s <<"\n";
  18     s++;
  19     if(s==60){
  20       s=0;
  21       m++;}
  22     if(m==60){
  23       m=0;
  24       h++;}
  25     if(h==24){
  26       h=0;}
  27     prueba++;
  28     for(int inicio = (time(NULL) + 1); time(NULL)!= inicio;  time(NULL)){ } 
  29   }
  30   return 0;  
  31 }

Algoritmantes/Reloj (last edited 2008-04-20 14:38:08 by localhost)