romasha ali

romasha ali

  • 2k
  • 94
  • 32.2k

code block c++ exception

Apr 9 2016 7:28 PM
hi,
i m making clock in code blocks C++ but it giving an exception kindly check the given code and help me out as soon as possible
------CODE------
#include <graphics.h>
#include <time.h>
int main()
{
int gd=DETECT;
int gm;
initgraph(&gd,&gm,"C:\\TC\\BGI");
time_t rawTime;
struct tm * currentTime;
char a[100];
while(1)
{
rawTime =time(NULL);
currentTime=localtime(&rawTime);
strftime(a,100,"%I:%M:%S",currentTime);
setcolor(11);
settextstyle(3,HORIZ_DIR,10);
outtextxy(200,100,a);
strftime(a,100,"%p",currentTime);
settextstyle(3,HORIZ_DIR,2);
outtextxy(600,8,a);
strftime(a,100,"%a,%d %b,%y",currentTime);
settextstyle(3,HORIZ_DIR,5);
outtextxy(310,130,a);
delay(1000);
}
getch();
closegraph();
}
 

Answers (2)