Sunday, 30 October 2011

Stop watch C++ code



Stop watch C++ code
#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>

  void stpshp();

  void main()
  {clrscr();
  int gdriver = DETECT, gmode, errorcode;
  initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
  stpshp();
  int h=1,mm=2,ss=3,ms=4;
      for(h=0; h<60; h++)
      {
for(mm=0;mm<60; mm+=1)
{ for(ss=0; ss<60; ss+=1)
  { for(ms=0; ms<60; ms+=1)
     {
      gotoxy(22,9);
      cout<<h;
      gotoxy(37,9);
      cout<<mm;
      gotoxy(51,9);
      cout<<ss;
      gotoxy(37,11);
      cout<<ms;


     delay(16.9);
    }
     }
     }
     }

 getche();
 }

void stpshp()
 {
  setcolor(RED);
  settextstyle(4,0,6);
  outtextxy(160,4,"Stop Watch");
  rectangle(90,10,530,70);
/////////////////////////////////////////////////////////////////////
  settextstyle(0,0,0);
  rectangle(130,120,460,155);
  rectangle(130,120,240,155);
  rectangle(240,120,350,155);
  rectangle(240,155,350,190);

  outtextxy(145,110,"Hours");
  outtextxy(255,110,"Minuts");
  outtextxy(370,110,"Seconds");
  setcolor(RED);
  rectangle(10,425 ,620,477);
  settextstyle(0,0,1);
  outtextxy(16,430,"NAME: Muhammad Waqas");
  outtextxy(16,445,"Roll # 9275");
  outtextxy(16,460,"Class : BCs-A(2011 - 2014)");
  outtextxy(400,430,"S u b m e t t e d  T o");
  outtextxy(380,460,"S i r .  U m e r  H a y a t");
  settextstyle(4,0,16);
  outtextxy(30,90,"V      V");

   }






No comments:

Post a Comment