All source code in C/ C++ Ask a C/ C++ Pro Discussion Forum Categories All jobs in C/ C++
displays,clock,press,functionality
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
C/ C++ Stats

 Code: 1,227,898. lines
 Jobs: 159. postings

 How to support the site

 
Sponsored by:
Quick Search for:  in language:    
You are in:
 
Login





Latest postings for C/ C++.
Dijkstra's Algorithm
By Adri Jovin on 11/18


Kruskal's Algorithm
By Adri Jovin on 11/18


Prim's Algorithm
By Adri Jovin on 11/18


Click here to see a screenshot of this code!Pyramid Figures 1.0
By Jake Rodriguez Pomperada on 11/17

(Screen Shot)

Click here to see a screenshot of this code!convert character to number or number
By emannuel saligue on 11/17

(Screen Shot)

AVL Rotation
By Adri Jovin on 11/16


ftpupload
By sam lee on 11/15


Click here to put this ticker on your site!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!



 
 
   

key press event- updated

Print
Email
 
VB icon
Submitted on: 11/5/2009 9:17:11 AM
By: I.SUNDARRAJ 
Level: Beginner
User Rating: Unrated
Compatibility:C

Users have accessed this code 591 times.
 
 
     displays clock.. and has key press functionality.......
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

//**************************************
//     
//INCLUDE files for :key press event- up
//     dated
//**************************************
//     
#include<stdlib.h>
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<dos.h>
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

//**************************************
//     
// Name: key press event- updated
// Description:displays clock.. and has 
//     key press functionality.......
// By: I.SUNDARRAJ
//
//This code is copyrighted and has// limited warranties.Please see http://
//     www.Planet-Source-Code.com/vb/scripts/Sh
//     owCode.asp?txtCodeId=12914&lngWId=3//for details.//**************************************
//     

int oo,ext1=1,ext=2,lin=0,xx,lin1=1, kk=90,kkk=90,kkkk=90,o=0,sta=0,cx=0,cy=0,clen=0,cclen=0,check=0,check1=-1,hour[10],min[10],sec[10],menuvar=0;
char sub[10][10];
float cval[25];
void mino(int k,int size)


    {
    int adj,opp;
    if(k<=90&&k>=0)


        	{
        	adj=cval[k]*cclen;
        	opp=sqrt((cclen*cclen)-(adj*adj));
        	circle(cx+adj,cy-opp,size);
        if(oo==1)	line(cx,cy,cx+adj,cy-opp);
    }

if(k<180&&k>=90) { adj=cval[180-k]*cclen; opp=sqrt((cclen*cclen)-(adj*adj)); circle(cx-adj,cy-opp,size); // ellipse(cx,cy,0,90,clen,cclen); // ellipse(cx,cy,k,0,clen,cclen); if(oo==1) line(cx,cy,cx-adj,cy-opp); }
if(k<=270&&k>=180) { adj=cval[k-180]*cclen; opp=sqrt((cclen*cclen)-(adj*adj)); circle(cx-adj,cy+opp,size); if(oo==1) line(cx,cy,cx-adj,cy+opp); }
if(k<=360&&k>=270) { adj=cval[360-k]*cclen; opp=sqrt((cclen*cclen)-(adj*adj)); circle(cx+adj,cy+opp,size); if(oo==1) line(cx,cy,cx+adj,cy+opp); }
if(sta==0) outtextxy(cx+14,cy,"AM"); else outtextxy(cx+14,cy,"PM"); }
void disp() { int temp=0; if(sta==1) temp=12; else temp=0; if(kkkk<=90&&kkkk>=0) printf("\t\t%d:",((90-kkkk)/30)+temp); else printf("\t\t%d:",((450-kkkk)/30)+temp); if(kkk<=90&&kkk>=0) printf("%d:",(90-kkk)/6); else printf("%d:",(450-kkk)/6); if(kk<=90&&kk>=0) printf("%d",(90-kk)/6); else printf("%d",(450-kk)/6); }
void value() { cval[0]=1.000000000; cval[6]=.994521895; cval[12]=.9781476; cval[18]=.951056516; cval[24]=.913545457; cval[30]=.866025403; cval[36]=.809016994; cval[42]=.743144825; cval[48]=.669130606; cval[54]=.587785252; cval[60]=.5000000000; cval[66]=.406736643; cval[72]=.309016994; cval[78]=.20791169; cval[84]=.104528463; cval[90]=0.000000000; }
void checking() { int limit4,limit3,limit2,count,lim4,lim3,lim2,lim1=0; if((kkkk>=0)&&(kkkk<=90)) { limit4=90; lim4=0; }
else { limit4=360; lim4=3; }
if((kkk>=0)&&(kkk<=90)) { limit3=90; lim3=0; }
else { limit3=360; lim3=15; }
if((kk>=0)&&(kk<=90)) { limit2=90; lim2=0; }
else { limit2=360; lim2=15; }
if(sta==1) lim1=12; for(count=0;count<10;count++) { if((hour[count]==(((limit4-kkkk)/30)+lim4)+lim1)) { if((min[count]==(((limit3-kkk)/6)+lim3))) { if((sec[count]==(((limit2-kk)/6)+lim2))) { check1=count; min[count]=-1; check=1; break; }
} }
}
}
void getting1(char ch) { int del,i,limi; switch (ch) { case 's': { clrscr(); cleardevice(); for(i=0;i<10;i++) { if(min[i]==(-1)) { printf("Enter the time"); scanf("%d%d%d%s",&hour[i],&min[i],&sec[i],sub[i]); break; }
} if(i==11) { printf("full"); delay(10); }
break; }
case 'l': { clrscr(); cleardevice(); printf("\t\tTHE TABLE"); for(i=0;i<10;i++) printf("\n\t\t %d %d %d %d %s",i,hour[i],min[i],sec[i],sub[i]); outtextxy(150,380,"NOTE:IF ANY VALUE IS -1 THE CORRESPONDING ENTRY IS INVALID"); outtextxy(400,400,"PRESS ANY KEY TO QUIT"); getch(); break; }
case 'd': { clrscr(); cleardevice(); printf("\t\tTHE TABLE"); for(i=0;i<10;i++) printf("\n\t\t %d %d %d %d %s",i,hour[i],min[i],sec[i],sub[i]); printf("\nENTER THE INDEX TO DELETE(Enter -1 to not del anything)"); scanf("%d",&del); if((del<11)&&(del>=0)) min[del]=-1; break; }
case 'o': { if(menuvar==1) {menuvar=0; break;} if(check1>=0&&check1<10) { min[check1]=-1; check=0; }
break; }
case 'x': { clrscr(); cleardevice(); back:printf("\nENTER THE TIME"); scanf("%d%d%d",&kkkk,&kkk,&kk); if(kkkk>23||kkk>59||kk>59) { clrscr(); cleardevice(); printf("\nENTER CORRECTLY"); goto back; }
if(kkkk>=12) {sta=1; kkkk=kkkk-12; }
else sta=0; if(kk>=0&&kk<=15) limi=-90; else limi=-450; kk=abs(limi+kk*6); if(kkk>=0&&kkk<=15) limi=-90; else limi=-450; kkk=abs(limi+kkk*6); if(kkkk>=0&&kkkk<=3) {if(kkkk==0) o=0; else o=1; limi=-90; }
else { limi=-450; o=0; }
kkkk=abs(limi+kkkk*30); break; }
case 'm': { menuvar=1; break; }
case 'c': { clrscr(); cleardevice(); printf("ENTER THE (new) RADIUS"); scanf("%d",&clen); break; }
case 't': { disp(); }
case 'n': { break; }
default: { cleardevice(); outtextxy(134,3,"INVALID"); delay(10); }
}}
char getting() { int status;char cch; asm{mov status,0X00; mov ah,0X01; int 0X16; jz sun; mov status,1; mov cch,al; } sun: if(status==1) { asm{mov ah,0X00; int 0X16;}return cch; }
else return 'n'; }
void menu() { outtextxy(300,300,"x:TO SET TIME"); outtextxy(300,310,"s:TO SET REMAINDER"); outtextxy(300,320,"d:TO delete A REMAINDER"); outtextxy(300,360,"e:TO EXIT"); outtextxy(300,330,"o:TO INFORM THAT U GOT THE REMAINDER"); outtextxy(300,340,"IF U PRESS o IT WONT SHOW THE SUB ANYMORE"); outtextxy(300,350,"ALSO if THE MENU IS ON IT WILL BE OFFED"); outtextxy(300,370,"l:LISTS THE REMAINDERS MEM"); outtextxy(300,380,"c:CHANGES THE CLOCK SIZE"); outtextxy(300,400,"t:TO DISPLAY THE TIME"); }
void main() { int i,io,rr=1,rr3=2,rr11=2,gd=DETECT,gm,gff=1,gff3; char g; int gff11,sty111,sty,sty3,sty1,sty11,gff1=15,rr1=1; initgraph(&gd,&gm,""); cleardevice(); for(i=0;i<10;i++) min[i]=-1; //printf("ENTER CENTER AND RADIUS(above 25)"); //scanf("%d%d%d",&cx,&cy,&clen); xx=cx=cy=250; clen=120; sty=0; sty3=(clen/2); sty1=(clen/2)/30; gff3=31;gff1=15; sty11=15*sty1; gff11=15; sty111=15*sty1; setcolor(kkk); circle(cx,cy,clen); cclen=clen-15; mino(kkkk,4); cclen=clen-10; mino(kkk,6); cclen=clen-8; mino(kk,8); label: /* if(lin1==1) { lin+=5; if(lin==35) lin1=2; cx+=5; } else { lin-=5; if(lin==-30) lin1=1; cx-=5; } line(xx,25,cx,cy);*/ value(); outtextxy(250,4,"KEY PRESS EVENT IN C"); // if(rr==1) { sty+=sty1; gff++; if(gff==31) { rr=2; sty=clen/2; } } else { sty-=sty1; gff--; if(gff==0) { rr=1; sty=1; } } //// if(rr3==1) { sty3+=sty1; gff3++; if(gff3==31) { rr3=2; sty3=clen/2; } } else { sty3-=sty1; gff3--; if(gff3==0) { rr3=1; sty3=1; } } if(rr1==1) { sty11+=sty1; gff1=gff1+1; if(gff1==31) { rr1=2; sty11=clen/2; } } else { sty11-=sty1; gff1--; if(gff1==0) { rr1=1; sty11=1; } } if(rr11==1) { sty111+=sty1; gff11=gff11+1; if(gff11==31) { rr11=2; sty111=clen/2; } } else { sty111-=sty1; gff11--; if(gff11==0) { rr11=1; sty111=1; } } if(kkk%48==0) setcolor(WHITE); else setcolor(kkk); //sss// for(io=1;io<250;io++) circle(random(700),random(700),1); for(io=1;io<=100;io++) putpixel(random(700),random(400),kkk); setcolor(kkk); ellipse(cx,cy,0,360,sty111,clen/2); ellipse(cx,cy,0,24,sty111,sty111); ellipse(cx,cy,0,360,sty11,clen/2); ellipse(cx,cy,254,270,sty11,sty11); ellipse(cx,cy,0,360,sty,clen/2); ellipse(cx,cy,140,160,sty,sty); ellipse(cx,cy,0,360,sty3,clen/2); ellipse(cx,cy,70,99,sty3,sty3); cclen=clen-15; oo=1; setcolor(WHITE); mino(kkkk,4); if(ext==1) { if(kk==90) ext=2; ellipse(cx,cy,kk-1,90,clen,cclen); } else { ellipse(cx,cy,90,kk-1,clen,cclen); if(kk==90) ext=1; } oo=0; cclen=clen-10; ellipse(cx,cy,kkk-1,90,clen/2+((clen/2)/2),cclen/2+((cclen/2)/2)); cclen=cclen/2+((cclen/2)/2); setcolor(kkk); mino(kkk,6); cclen*=cclen; cclen=clen-8; mino(kk,8); checking(); if(check==1) outtextxy(50,50,sub[check1]); if(menuvar==1) menu(); else outtextxy(350,350,"press m to know the menu"); //// settextstyle(TRIPLEX_FONT, HORIZ_DIR, 4); outtextxy(cx-7,cy-15,"S"); settextstyle(DEFAULT_FONT, HORIZ_DIR, 1); for(i=0;i<=59;i++) delay(20); kk-=6; cleardevice(); if(kk==90) {o=1; kkk-=6; } if((o!=0)&&kkk==90) { if(kkkk==120) { if(sta==0) sta=1; else sta=0; } kkkk-=30; o=0; } g=getting(); if(g=='e') goto end; getting1(g); if(kk==0) kk=360; if(kkk==0) kkk=360; if(kkkk==0) kkkk=360; goto label; end: }


Other 1 submission(s) by this author

 

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments

 There are no comments on this submission.
 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.


 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Games | Feedback | Customize | C/ C++ Home | Site Home | Other Sites | Open Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2009 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.   Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.