Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/04/2010, 07:42
Saintmaster
 
Fecha de Ingreso: abril-2010
Mensajes: 2
Antigüedad: 14 años
Puntos: 0
Duda con algoritmo

quiero saber si este algoritmo esta bien hecho

Código C:
Ver original
  1. #include <cstdlib>#include <time.h>#include <iostream>  using namespace std; int main(int argc, char *argv[]){      struct tm * fecha_hora; /* tm es un tipo estructurado definido en <time.h>                                    //que contiene cada campo de fecha y hora */  time_t segundos;      segundos = time(NULL); /* obtiene los segundos desde 1-1-1970 */    fecha_hora=localtime(&segundos); /* convierte los 'segundos' en la hora local */     system("color E"); cout<<"hora = [ "<<fecha_hora->tm_hour<< ":"<<fecha_hora->tm_min<<":"<<fecha_hora->tm_sec<<" ]"<<endl;    cout<<"fecha = [ "<<fecha_hora->tm_mday<<"/"<<fecha_hora->tm_mon<< "/"<<fecha_hora->tm_year<<" ]" ;     getchar();    return EXIT_SUCCESS;}