Saturday, September 24, 2022

Digital Clock

Digital Clock using C++

Code:-

 // C++


#include<graphics.h> #include<conio.h> #include<time.h> #include<stdio.h> #include<dos.h> #include<iostream.h> int main() { int gd=DETECT; int gm; initgraph(&gd,&gm,"C:\\TurboC3\\BGI"); time_t rawTime; struct tm * currentTime; char a[100]; //Introduction setcolor(11); settextstyle(1,HORIZ_DIR,4); outtextxy(80,100,"THIS PROJECT IS PERFORMED BY :"); //Name of team partners.... setcolor(9); settextstyle(7,HORIZ_DIR,3); outtextxy(80,150,"MANAV PATIL"); outtextxy(80,200,"RAJ MHATRE"); outtextxy(80,250,"PRACHI"); setcolor(4); settextstyle(5,HORIZ_DIR,2); outtextxy(200,450,"(NOTE:- Enter any key to open digital clock)"); getch(); cleardevice(); //Loading Page..... int midx= getmaxx()/3.5; int midy= getmaxy()/3; int width=textwidth("Digital Clock"); int height = textheight("Digital Clock"); setcolor(9); rectangle(150,100,500,300); setcolor(11); settextstyle(3,HORIZ_DIR ,5); outtextxy(midx, midy, "DIGITAL CLOCK"); setcolor(4); settextstyle(1,HORIZ_DIR ,1); outtextxy(midx+170, midy+100, "LOADING"); delay(1000); outtextxy(midx+250, midy+100, "."); delay(800); outtextxy(midx+260, midy+100, "."); delay(600); outtextxy(midx+270, midy+100, "."); delay(500); outtextxy(midx+280, midy+100, "."); delay(400); outtextxy(midx+290, midy+100, "."); delay(200); outtextxy(midx+300, midy+100, "."); delay(1000); cleardevice(); //Clock Program....... while(1) { setcolor(11); rectangle(50,120,600,450); setcolor(4); settextstyle(1,HORIZ_DIR,5); outtextxy(180,30,"DIGITAL CLOCK"); //Heading.... setcolor(14); line(150,80,500,80);//Underline for heading.. //real time clock program.... rawTime = time(0); currentTime = localtime(&rawTime); strftime(a,100,"%I:%M:%S",currentTime); setcolor(11); settextstyle(3,HORIZ_DIR,8); outtextxy(150,150,a); strftime(a,100,"%a, %d %b, %Y", currentTime); settextstyle(4,HORIZ_DIR,5); outtextxy(130,310,a); delay(1000); cleardevice(); } getch(); closegraph(); return 0; }


Output:










1 comment:

Login And Registration Updated

OOP Microproject....... (Codeblocks is recommended to perform this Program) #include <iostream> #include <conio.h> #include <...