October 2009
M T W T F S S
    Nov »
 1234
567891011
12131415161718
19202122232425
262728293031  

Archives

Categories

  • [+]ASP.NET (7) 
  • [+]C# (87) 
  • [—]C++ (13) 
  • [+]Delphi (20) 
  • [+]JavaScript (24) 
  • [+]Regular Expressions (7) 
  • [+]SQL (13) 
  • [+]VB (100) 
  • [+]VB.NET (4) 

Online

Users: 7 Guests
  • Loading...


    Loading...

    Login






    Register | Lost password?

    Register





    A password will be mailed to you.
    Log in | Lost password?

    Retrieve password





    A confirmation mail will be sent to your e-mail address.
    Log in | Register
  • Seven Segment Display

    /*  Seven Segment Display
    
    No.  a  b  c  d     1 2 3 4 5 6 7
    -----------------------------------
    0    0  0  0  0	  1 1 1 1 1 1 0
    1    0  0  0  1     0 1 1 0 0 0 0
    2    0  0  1  0     1 1 0 1 1 0 1
    3    0  0  1  1     1 1 1 1 0 0 1
    4    0  1  0  0     0 1 1 0 0 1 1
    5    0  1  0  1     1 0 1 1 0 1 1
    6    0  1  1  0     1 0 1 1 1 1 1
    7    0  1  1  1     1 1 1 0 0 0 0
    8    1  0  0  0     1 1 1 1 1 1 1
    9    1  0  0  1     1 1 1 1 0 1 1
    */
    
    #include<stdio.h>
    #include<conio.h>
    #include<iostream.h>
    #include<graphics.h>
    #include<dos.h>
    #include<time.h>
    #include<string.h>
    
    #define ON LIGHTRED
    #define OFF BLACK
    #define CCOLOR BLUE
    #define BLOWDELAY 11
    #define BACKCOLOR LIGHTBLUE
    
    int array[10][7]={
    		   1,1,1,1,1,1,0,
    		   0,1,1,0,0,0,0,
    		   1,1,0,1,1,0,1,
    		   1,1,1,1,0,0,1,
    		   0,1,1,0,0,1,1,
    		   1,0,1,1,0,1,1,
    		   1,0,1,1,1,1,1,
    		   1,1,1,0,0,0,0,
    		   1,1,1,1,1,1,1,
    		   1,1,1,1,0,1,1
    		 };
    
    void digital(int number,int c,int r)
    {
     int i=0;
     setlinestyle(0,3,3);
    
     setcolor(array[number][i]?ON:OFF);
     i++;
     line(c,r,c+45,r); // Segment 1
    
     setcolor(array[number][i]?ON:OFF);
     i++;
     line(c+46,r+5,c+46,r+34); // Segment 2
    
     setcolor(array[number][i]?ON:OFF);
     i++;
     line(c+46,r+45,c+46,r+74); // Segment 3
    
     setcolor(array[number][i]?ON:OFF);
     i++;
     line(c,r+80,c+45,r+80); // Segment 4
    
     setcolor(array[number][i]?ON:OFF);
     i++;
     line(c-1,r+45,c-1,r+74); // Segment 5
    
     setcolor(array[number][i]?ON:OFF);
     i++;
     line(c-1,r+5,c-1,r+34); // Segment 6
    
     setcolor(array[number][i]?ON:OFF);
     i++;
     line(c,r+40,c+45,r+40); // Segment 7
     setlinestyle(0,3,1);
    }
    
    void balloon(int col,int row,int startrad,int endrad)
    {
    	for(int r=startrad;r<=endrad;r++)
    	{
    	setcolor(CCOLOR);
    	circle(col,row,r);
    	delay(BLOWDELAY);
    	setcolor(BLACK);
    	circle(col,row,r);
    	}
    
    for(r=endrad;r>=startrad;r--)
    	{
    	setcolor(CCOLOR);
    	circle(col,row,r);
    	delay(BLOWDELAY);
    	setcolor(BLACK);
    	circle(col,row,r);
    
    	}
    }
    
    void systime(void)
    {
       time_t timer;
       struct tm *tblock;
       /* gets time of day */
       timer = time(NULL);
       /* converts date/time to a structure */
       tblock = localtime(&timer);
       char c[50];
       strcpy(c,asctime(tblock));
       for(int i=11;i<20;i++)
       {
       printf("%c",c[i]);
       }
    }
    
    void main()
    {
     clrscr();
     int gd,gm;
     detectgraph(&gd,&gm);
     initgraph(&gd,&gm,"");
     delay(10);
    // setbkcolor(BACKCOLOR);
     for(int no=9;no>=0&&!kbhit();no--)
     {
     digital(no,getmaxx()/2-22,getmaxy()/2-37);
    // setbkcolor(no);
     delay(1500);
     //balloon(getmaxx()/2,getmaxy()/2,70,200);
     }
    // balloon(130,130,5,120);
     closegraph();
     systime();
     delay(500);
    }
    
    Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • Digg
    • del.icio.us
    • Bloglines
    • Facebook
    • Google Bookmarks
    • LinkedIn
    • Technorati
    • TwitThis
    • Webnews

    Leave a Reply

     

     

     

    You can use these HTML tags

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">

    Spam Protection by WP-SpamFree Plugin