Reloj Binario

Es un Reloj binario hecho en Turbo C++ sin usar la librería graphics.

#include <conio.h>
#include <stdio.h>
#include <dos.h>
#include <iostream.h>
#include <time.h>
#include <bios.h>
#include <math.h>
class Hora{
            public:
                        Hora();
                        void estableceHora(int,int,int);
                        void imprimeMilitar();
                        void imprimeEstandar();
                        void numero(int);
                        void ventana(int,int,int,int);
                        void puntos();
            private:
                        int x;
                        int y;
                        int hora;
                        int minuto;
                        int segundo;
                        //int temp;
};
Hora::Hora(){
            hora=minuto=segundo=0;  //contructor inicia valores en cero
};
void Hora::estableceHora(int h,int m,int s){
            hora=(h > 0 && h < 24)? h: 0;
            minuto=(m > 0 && m < 60)? m:0;
            segundo=(s > 0 && s < 60)? s:0;
}
void Hora::imprimeMilitar(){
            //gotoxy(40,22);
            //cout<<(hora < 10 ? "0": "") << hora << ":"
            //<<(minuto < 10 ? "0": "") <<minuto;
}
void Hora::imprimeEstandar(){
            gotoxy(40,20);
cout<<((hora==0 || hora==12) ? 12 : hora % 12)
                        <<":" <<(minuto < 10 ? "0":"")<< minuto
                        <<":" <<(segundo < 10 ? "0":"")<<segundo
                        <<(hora<12 ? " AM": " PM");
            //window(53,21,54,22);
            //textbackground(BLACK);
            //clrscr();

}
void Hora::ventana(int x1,int y1,int x2, int y2){
//textbackground(BLACK);
//clrscr();
            window(x1,y1,x2,y2);
            textbackground(GREEN);
            clrscr();
}
void Hora::puntos(){
            textbackground(BLACK);
            clrscr();
            window(30,15,31,16);
            hora>=20 ? textbackground(4):textbackground(6);
            clrscr();
            window(30,18,31,19);
            hora>=10 && hora<20 ? textbackground(4):textbackground(6);
            clrscr();
            window(33,9,34,10);
            hora-10==8 || hora==8 ?          textbackground(4):textbackground(6);
            hora-10==9 || hora==9 ?          textbackground(4):textbackground(6);
            clrscr();
            window(33,12,34,13);
            hora==4 || hora-10==4 ||hora-20==4 ||
            hora==5 || hora-10==5 ||hora-20==5 ||
            hora==6 || hora-10==6 ||hora-20==6 ||
            hora==7 || hora-10==7 ||hora-20==7?textbackground(4):textbackground(6);
            clrscr();
            window(33,15,34,16);
            hora==2 || hora-10==2 ||hora-20==2 ||
            hora==3 || hora-10==3 ||hora-20==3 ||
            hora==6 || hora-10==6 ||hora-20==6 ||
            hora==7 || hora-10==7 ||hora-20==7?textbackground(4):textbackground(6);
            clrscr();
            window(33,18,34,19);
            hora==1 || hora-10==1 ||hora-20==1 ||
            hora==3 || hora-10==3 ||hora-20==3 ||
            hora==5 || hora-10==5 ||hora-20==5 ||
            hora==7 || hora-10==7 ||hora-20==7 ||
            hora==9 || hora-10==9 ?textbackground(4):textbackground(6);
            clrscr();
            window(36,12,37,13);
            minuto>=40 && minuto <=59 ?textbackground(4):textbackground(6);
            clrscr();
            window(36,15,37,16);
            minuto>=20 && minuto <=39 ?textbackground(4):textbackground(6);
            clrscr();
            window(36,18,37,19);
            (minuto>=10 && minuto <=19)||
            (minuto>=30 && minuto <=39)||
            (minuto>=50 && minuto <=59) ?textbackground(4):textbackground(6);
            clrscr();
            window(39,9,40,10);
            minuto-((minuto/10)*10)==9 ||
            minuto-((minuto/10)*10)==8 ?textbackground(4):textbackground(6);
            clrscr();
            window(39,12,40,13);
            minuto-((minuto/10)*10)==4 ||
            minuto-((minuto/10)*10)==5 ||
            minuto-((minuto/10)*10)==6 ||
            minuto-((minuto/10)*10)==7 ?textbackground(4):textbackground(6);
            clrscr();
            window(39,15,40,16);
            minuto-((minuto/10)*10)==2 ||
            minuto-((minuto/10)*10)==3 ||
            minuto-((minuto/10)*10)==6 ||
            minuto-((minuto/10)*10)==7 ?textbackground(4):textbackground(6);
            clrscr();
            window(39,18,40,19);
            minuto-((minuto/10)*10)==1 ||
            minuto-((minuto/10)*10)==3 ||
            minuto-((minuto/10)*10)==5 ||
            minuto-((minuto/10)*10)==7 ||
            minuto-((minuto/10)*10)==9 ?textbackground(4):textbackground(6);
            clrscr();

            window(42,12,43,13);
            segundo>=40 && segundo <=59 ?textbackground(4):textbackground(6);
            clrscr();
            window(42,15,43,16);
            segundo>=20 && segundo <=39 ?textbackground(4):textbackground(6);
            clrscr();
            window(42,18,43,19);
            (segundo>=10 && segundo <=19)||
            (segundo>=30 && segundo <=39)||
            (segundo>=50 && segundo <=59) ?textbackground(4):textbackground(6);
            clrscr();
            window(45,9,46,10);
            segundo-((segundo/10)*10)==9 ||
            segundo-((segundo/10)*10)==8 ?textbackground(4):textbackground(6);
            clrscr();
            window(45,12,46,13);
            segundo-((segundo/10)*10)==4 ||
            segundo-((segundo/10)*10)==5 ||
            segundo-((segundo/10)*10)==6 ||
            segundo-((segundo/10)*10)==7 ?textbackground(4):textbackground(6);
            clrscr();
            window(45,15,46,16);
            segundo-((segundo/10)*10)==2 ||
            segundo-((segundo/10)*10)==3 ||
            segundo-((segundo/10)*10)==6 ||
            segundo-((segundo/10)*10)==7 ?textbackground(4):textbackground(6);
            clrscr();
            window(45,18,46,19);
            segundo-((segundo/10)*10)==1 ||
            segundo-((segundo/10)*10)==3 ||
            segundo-((segundo/10)*10)==5 ||
            segundo-((segundo/10)*10)==7 ||
            segundo-((segundo/10)*10)==9 ?textbackground(4):textbackground(6);
            clrscr();
            window(50,18,51,19);
            textbackground(BLACK);
            clrscr();
}

void main(){
clrscr();
            Hora h;
            int horas, minutos, segundos, tmp;
            long bios_time;
            float seg;
            //h.ventana(2,2,14,6);
            while(!kbhit()){
                        bios_time = biostime(0, 0L);
                        horas=int(bios_time / CLK_TCK / 3600);
                        minutos=int (bios_time / CLK_TCK / 60) % 60;
                        seg=(bios_time / CLK_TCK)-float((horas-1)*3600);
                        segundos=int (seg)%60;
                        h.estableceHora(horas,minutos,segundos);
                                   gotoxy(2,2);
                                    //cout <<"La hora militar es: ";
                                   h.imprimeMilitar();
                                   gotoxy(2,4);
                                   //cout <<"La hora estandar es: ";
                                   h.imprimeEstandar();
                                   h.puntos();
                                   //h.ventana(2,2,14,6);
            }

}