Beruflich Dokumente
Kultur Dokumente
/*************************************************************************
**********************************************
B.Jeevanantham
Dr.Mahalingam college of Engg & Tech
Email:ivsjeeva@yahoo.co.in
**************************************************************************
***********************************************/
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
void printline(int,int);
//Fuction declaration
main()
{
int i,j=0,k=0,time,difference=6,count=0,mcnt=0,fcnt=0,choice;
char mname[1000],fname[1000],tfname[1000],tm[1000],tf[1000],ch='N';
char a[7]={"flames"};
int w=219,f=178,r=1,l=4,A=220,m=15,e=127,s=220;
clrscr();
printline(8,1);
printf("
%c%c%c
",w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w);
printf("
%c %c %c %c %c %c %c %c %c %c
%c
",w,w,w,w,w,w,w,w,w,w,w,w);
printf("
%c %c %c%c%c %c %c %c %c %c %c
%c%c%c
",w,w,w,w,w,w,w,w,w,w,w,w,w,w,w);
printf("
%c %c %c %c %c %c %c %c %c %c
%c
",w,w,w,w,w,w,w,w,w,w,w,w);
printf("
%c%c%c
",w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w);
delay(1000);
printf("
to");
delay(1000);
clrscr();
printline(8,1);
printf("
%c%c%c %c
%c %c %c %c%c%c
%c%c%c
",f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f);
printf("
%c
%c %c %c %c %c %c %c %c
",f,f,f,f,f,f,f,f,f,f);
printf("
%c%c%c
",f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f);
printf("
%c
%c %c %c %c %c %c
%c
%c%c%c %c %c %c %c %c%c%c
%c
",f,f,f,f,f,f,f,f,f);
printf("
%c%c%c
",f,f,f,f,f,f,f,f,f,f,f,f,f,f,f);
delay(1000);
printline(25,60);
clrscr();
printline(10,1);
printf("Enter the MALE Name %c :",11);
gets(mname);
strupr(mname);
printf("
strupr(fname);
strcpy(tfname,fname);
if(mname[0]=='
Shuffle:
Code :
/*
Programmed By : pa.chidhambaram.
E-Mail: pachidhambaram@yahoo.com
pachithambaram@hotmail.com
Mobile: 9894586845
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<time.h>
#include<dos.h>
#include<stdlib.h>
# define TIME_OVER 0
# define WIN 1
# define EXITS 2
//FUNCTION PROTOTYPES
void GetRandomValues();
void printbox(int,int,int,int);
void Fscreen(int,int,int,int);
void Sscreen(int,int,int,int);
void process(int,int);
void DisTime();
void select(int);
void Start();
void Exit();
void Gprint(int,int,int,int,int);
int check(int,int);
int match();
void click();
void Sound(int,int);
void erase(int,int,int,int);
void window(int,int,int,int);
void Button(int r,int c,int flag,char *msg);
void buttoneffect(int,int,int,int,int,char*);
void button(int,int ,int ,int ,int ,char *);
void lines(int,int,int,int);
void initmouse();
void showmouse();
void hidemouse();
void ZeroMouse();
void getmouse(int *,int *,int *);
void restrictmouse(int, int, int, int);
void restoremouse();
//VARIABLES
char *success[]={"1","2","3","4","5","6","7","8"," "};
char *caption[]={"0","0","0","0","0","0","0","0"," "};
int randomval[10];
int start,end;
int move=0;
int WX1=140,WY1=110,WX2=330,WY2=290;
int X1=75,Y1=75,X2=570,Y2=400;
void GetRandomValues()
{
int count=0,temp,i,flag;
randomize();
while(count < 8)
{
temp = rand()%9;
flag=0;
for(i=0;i<=count;i++)
{
if(randomval[i]==temp)
{
flag=1;
break;
}
}
if(flag!=1)
{
randomval[count]=temp;
if(randomval[count]==0)
strcpy(caption[count]," ");
else
itoa(randomval[count],caption[count],10);
count++;
}
}
}
void main()
{
int d=0,m=0,i,num;
GetRandomValues();
window(x1,y1,x2,y2);
setcolor(1); settextstyle(1,0,4);
outtextxy(x1+45,y1+100,"*******************************");
outtextxy(x1+45,y1+185,"*******************************");
printbox(x1+50,y1+130,x1+440,y1+190);
setcolor(11); settextstyle(1,0,6);
outtextxy(x1+60,y1+125,"SHUFFLE GAME");
button(x1+100,y1+250,x1+400,y1+275,1,"Start");
initmouse();
showmouse();
while(flag!=1)
{
getmouse(Button,x,y);
if(*Button==1)
{
if(*x > (x1+100) && *x < (x1+400) && *y > (y1+250) && *y < (y1+275))
{
hidemouse();
button(x1+100,y1+250,x1+400,y1+275,0,"Start");
Sound(1,1);
delay(350);
button(x1+100,y1+250,x1+400,y1+275,1,"Start");
showmouse();
flag=1;
break;
}
}
}
hidemouse();
// process(x1,y1);
}
char *b[]={"PLAY","EXIT"};
int MButton[1],x[1],y[1],i,j,count=0;
hidemouse();
window(x1,y1,x2,y2);
lines(x1+325,y1+2,397,1);
lines(x1+2,y1+250,400,0);
button(x1+20,y1+270,x1+300,y1+310,1,b[0]);
setcolor(0);
settextstyle(7,0,1);
outtextxy(x1+350,y1+25,"Start Time ");
outtextxy(x1+358,y1+120," Moves");
outtextxy(x1+350,y1+220,"Time Limit");
printbox(75+350,75+50,75+455,75+75);
printbox(75+350,75+145,75+455,75+170);
printbox(75+350,75+245,75+455,75+270);
window(WX1,WY1,WX2,WY2);
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
Button(i,j,1,caption[count]);
count++;
}
initmouse();
showmouse();
while(1)
{
getmouse(MButton,x,y);
if(*MButton==1)
{
if(*x > (x1+20) && *x < (x1+300) && *y > (y1+270) && *y < (y1+310))
{
hidemouse();
button(x1+20,y1+270,x1+300,y1+310,0,b[0]);
Sound(1,1);
delay(50);
button(x1+20,y1+270,x1+300,y1+310,1,b[0]);
showmouse();
break;
}
}
}
button((x1+20),y1+270,(x1+300),y1+310,1,b[1]);
while(1)
{
if(match(caption,success))
Exit(WIN);
count=0;
DisTime();
getmouse(MButton,x,y);
if(*MButton==1)
{
for(j=0;j<3;j++)
for(i=0;i<3;i++)
{
if(*x > ((WX1+10)+(i*57)) && *x < ((WX1+60)+(i*57)) &&
*y>((WY1+10)+(j*55)) && *y < ((WY1+60)+(j*55)))
{
hidemouse();
Button(j,i,0,caption[count]);
Sound(2,1);
select(count);
Button(j,i,1,caption[count]);
showmouse();
break;
}
count++;
}
if(*x > (x1+20) && *x < (x1+300) && *y > (y1+270) && *y < (y1+310))
{
hidemouse();
button((x1+20),y1+270,(x1+300),y1+310,0,b[1]);
Sound(3,5);
delay(250);
button((x1+20),y1+270,(x1+300),y1+310,1,b[1]);
showmouse();
Exit(3);
}
}
}
}
void DisTime()
{
struct time t;
gettime(&t);
t.ti_hour = t.ti_hour%12;
Gprint(500,130,t.ti_hour,t.ti_min,t.ti_sec);
}
void select(int count)
{
int i,j;
switch(count)
{
case 0:
if(check(1,0)) Button(0,1,1,caption[1]);
if(check(3,0)) Button(1,0,1,caption[3]);
break;
case 1:
if(check(0,1)) Button(0,0,1,caption[0]);
if(check(2,1)) Button(0,2,1,caption[2]);
if(check(4,1)) Button(1,1,1,caption[4]);
break;
case 2:
if(check(1,2)) Button(0,1,1,caption[1]);
if(check(5,2)) Button(1,2,1,caption[5]);
break;
case 3:
if(check(0,3)) Button(0,0,1,caption[0]);
if(check(4,3)) Button(1,1,1,caption[4]);
if(check(6,3)) Button(2,0,1,caption[6]);
break;
case 4:
if(check(1,4)) Button(0,1,1,caption[1]);
if(check(3,4)) Button(1,0,1,caption[3]);
if(check(5,4)) Button(1,2,1,caption[5]);
if(check(7,4)) Button(2,1,1,caption[7]);
break;
case 5:
if(check(2,5)) Button(0,2,1,caption[2]);
if(check(4,5)) Button(1,1,1,caption[4]);
if(check(8,5)) Button(2,2,1,caption[8]);
break;
case 6:
if(check(3,6)) Button(1,0,1,caption[3]);
if(check(7,6)) Button(2,1,1,caption[7]);
break;
case 7:
if(check(4,7)) Button(1,1,1,caption[4]);
if(check(6,7)) Button(2,0,1,caption[6]);
if(check(8,7)) Button(2,2,1,caption[8]);
break;
case 8:
if(check(5,8)) Button(1,2,1,caption[5]);
if(check(7,8)) Button(2,1,1,caption[7]);
break;
}
}
if(*caption[choice]==' ')
{
temp = caption[c];
caption[c]=" ";
caption[choice]=temp;
flag=1;
move++;
}
return flag;
}
int match()
{
int flag,i;
for(i=0;i<9;i++)
{
if(*caption[i] != *success[i])
{
flag=0;
break;
}
else
flag=1;
}
return flag;
}
hidemouse();
window(75,75,570,400);
setcolor(1);
setfillstyle(1,0);
bar3d(125,200,520,275,0,0);
setcolor(11);
settextstyle(8,0,4);
if(flag>=0&&flag<=1)
{
if(flag==0)
outtextxy(200,215," TIME OVER");
else if(flag==1)
outtextxy(130,215," CONGRATS U WON!");
delay(1000);
setcolor(1);
bar3d(125,200,520,275,0,0);
}
setcolor(11);
outtextxy(200,215," THANK YOU");
delay(1500);
setcolor(1);
bar3d(125,200,520,275,0,0);
delay(1000);
setcolor(11);
settextstyle(8,0,3);
outtextxy(185,220,"BY PACHIDHAMBARAM");
delay(1500);
erase(152,207,503,250);
cleardevice();
exit(1);
}
msgmov=(char*)malloc(10);
if(flag!=1)
{
temps = s + 180;
tempm = temps / 60;
temps = temps % 60;
tempm = m + tempm;
temph = tempm / 60;
tempm = tempm % 60;
temph = temph + h;
if(temps<10)
sprintf(msg1,"0%d",temps);
else
sprintf(msg1,"%d",temps);
moveto(x,y+195);
setcolor(11);
outtext(msg1);
if(tempm<10)
sprintf(msg1,"0%d",tempm);
else
sprintf(msg1,"%d",tempm);
moveto(x-30,y+195);
setcolor(11);
outtext(msg1);
if(temph<10)
sprintf(msg1,"0%d",temph);
else
sprintf(msg1,"%d",temph);
moveto(x-60,y+195);
setcolor(11);
outtext(msg1);
}
if(h<10)
sprintf(msgh,"0%d",h);
else
sprintf(msgh,"%d",h);
if(m<10)
sprintf(msgm,"0%d",m);
else
sprintf(msgm,"%d",m);
if(s<10)
sprintf(msgs,"0%d",s);
else
sprintf(msgs,"%d",s);
if(move<10)
sprintf(msgmov,"0%d",move);
else
sprintf(msgmov,"%d",move);
setcolor(11);
outtextxy(490,129,":");
outtextxy(460,129,":");
setcolor(11);
outtextxy(490,y+195,":");
outtextxy(460,y+195,":");
if(flag!=0)
{
if(sprev<10)
sprintf(msg1,"0%d ",sprev);
else
sprintf(msg1,"%d ",sprev);
if(sprev!=s)
{
moveto(x,y);
setcolor(0);
outtext(msg1);
}
if(mprev<10)
sprintf(msg1,"0%d",mprev);
else
sprintf(msg1,"%d",mprev);
if(mprev!=m)
{
moveto(x-30,y);
setcolor(0);
outtext(msg1);
}
if(hprev<10)
sprintf(msg1,"0%d",hprev);
else
sprintf(msg1,"%d",hprev);
if(hprev!=h)
{
moveto(x-60,y);
setcolor(0);
outtext(msg1);
}
if(mov<10)
sprintf(msg1,"0%d",mov);
else
sprintf(msg1,"%d",mov);
if(mov!=move)
{
moveto(x-30,y+96);
setcolor(0);
outtext(msg1);
}
}
moveto(x,y);
setcolor(11);
outtext(msgs);
moveto(x-30,y);
setcolor(11);
outtext(msgm);
moveto(x-60,y);
setcolor(11);
outtext(msgh);
moveto(x-30,y+96);
setcolor(11);
outtext(msgmov);
delay(100);
sprev=s;
mprev=m;
hprev=h;
mov=move;
flag=1;
if(temps==s && tempm == m && temph == h)
{
Sound(4,5);
Exit(TIME_OVER);
}
}
void printbox(int px1,int py1,int px2,int py2)
{
setfillstyle(1,0);
setcolor(8);
bar3d(px1,py1,px2,py2,0,0);
}
//Function Definitions
void window(int x1,int y1,int length,int width)
{
setfillstyle(1,16);
bar(x1-2,y1-2,length+2,width+2);
setfillstyle(1,8);
bar(x1-1,y1-1,length+1,width+1);
setfillstyle(1,7);
bar(x1,y1,length,width);
setcolor(WHITE);
line(x1,y1,length,y1);
line(x1,y1,x1,width);
setcolor(8);
line(x1+2,y1+2,length-2,y1+2);
line(x1+2,y1+2,x1+2,width-2);
setcolor(16);
line(x1+3,y1+3,length-4,y1+3);
line(x1+3,y1+3,x1+3,width-3);
setcolor(WHITE);
line(length,y1,length,width);
line(x1,width,length,width);
setcolor(8);
line(length-2,y1+2,length-2,width-2);
line(x1+2,width-2,length-2,width-2);
setcolor(16);
line(length-3,y1+3,length-3,width-3);
line(x1+3,width-3,length-4,width-3);
}
line(x1,y1,x2,y1);
line(x1,y1,x1,y2);
setcolor(15);
line(x1,y2,x2+1,y2);
line(x2+1,y1,x2+1,y2);
setcolor(0);
}
if(strlen(bname) < 2)
value=0;
if(flag==1)
moveto((x1+x2)/2-value,((y1+y2)/2)-8);
else
moveto((x1+x2)/2+2-value,((y1+y2)/2)-5);
settextstyle(2,0,5);
outtext(bname);
}
X1=X1+10;
Y1=Y1+10;
button(X1+(c*57),Y1+(r*55),(X1+50)+(c*57),(Y1+50)+(r*55),flag,msg);
setcolor(8);
line(x1+1,y1,x1+1,length);
setcolor(7);
line(x1+2,y1,x1+2,length+1);
setcolor(15);
line(x1+3,y1-2,x1+3,length+3);
setcolor(7);
line(x1+4,y1,x1+4,length+1);
setcolor(8);
line(x1+5,y1,x1+5,length);
setcolor(0);
line(x1+6,y1,x1+6,length);
}
}
for(i=y1-1;i<=y2;i++)
{
setviewport(x1-1,i,x2+1,i+1,1);
clearviewport();
delay(75);
}
}
void process(int x1,int y1)
{
int i;
for(i=0;i<=400;i++)
{
putpixel(x1+50+i,y1+300,0);
putpixel(x1+50+i,y1+301,8);
putpixel(x1+50+i,y1+302,7);
putpixel(x1+50+i,y1+303,15);
putpixel(x1+50+i,y1+304,7);
putpixel(x1+50+i,y1+305,8);
putpixel(x1+50+i,y1+306,0);
delay(30);
}
}
void Sound(int flag,int n)
{
int i;
for(i=1;i<=n;i++)
{
switch(flag)
{
case 1: sound(6000); break;
case 2: sound(4000); break;
nosound();
}
}
void initmouse()
{
i.x.ax=0;
int86(0x33,&i,&o);
}
void showmouse()
{
i.x.ax=1;
int86(0x33,&i,&o);
}
void hidemouse()
{
i.x.ax=2;
int86(0x33,&i,&o);
}
void ZeroMouse()
{
i.x.ax=4;
int86(0x33,&i,&o);
o.x.cx=0;
o.x.dx=0;
}
i.x.cx = y1;
i.x.dx = y2;
int86(0x33, &i, &o);
}
void restoremouse()
{
i.x.ax = 7;
i.x.cx = 0;
i.x.dx = 638;
int86(0x33, &i, &o);
i.x.ax = 8;
i.x.cx = 0;
i.x.dx = 478;
int86(0x33, &i, &o);
}
Smile animation:
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
main()
{
int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75;
void *p;
initgraph(&gd,&gm,"C:\\TC\\BGI");
setcolor(YELLOW);
circle(50,100,25);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(50,100,YELLOW);
setcolor(BLACK);
setfillstyle(SOLID_FILL,BLACK);
fillellipse(44,85,2,6);
fillellipse(56,85,2,6);
ellipse(50,100,205,335,20,9);
ellipse(50,100,205,335,20,10);
ellipse(50,100,205,335,20,11);
<stdio.h>
<conio.h>
<dos.h>
<graphics.h>
<stdlib.h>
union REGS i, o;
int left = 265, top = 250;
void initialize_graphics_mode()
{
int gd = DETECT, gm, error;
initgraph(&gd,&gm,"C:\\TC\\BGI");
error = graphresult();
if (error != grOk)
{
perror("Error ");
printf("Press any key to exit...\n");
getch();
exit(EXIT_FAILURE);
}
}
void showmouseptr()
{
i.x.ax = 1;
int86(0x33,&i,&o);
}
void hidemouseptr()
{
i.x.ax = 2;
int86(0x33,&i,&o);
}
void get_input()
{
int x, y;
while(1)
{
getmousepos(&x,&y);
/* mouse pointer in left of button */
if( x >= (left-3) && y >= (top-3) && y <= (top+30+3) && x < left )
{
draw_bar();
left = left + 4;
if (left > 350)
left = 190;
draw_button(left,top);
}
/* mouse pointer in right of button */
else if (x<=(left+100+3)&&y>=(top-3)&&y<=(top+30+3)&&x>(left+100))
{
draw_bar();
left = left - 4;
if (left < 190)
left = 350;
draw_button(left,top);
}
/* mouse pointer above button */
else if(x>(left-3) && y>=(top-3) && y<(top) && x<= (left+100+3))
{
draw_bar();
top = top + 4;
if (top > 320)
top = 180;
draw_button(left,top);
}
/* mouse pointer below button */
else if (x>(left-3)&&y>(top+30)&&y<=(top+30+3)&&x<=(left+100+3))
{
draw_bar();
top = top - 4;
if (top < 180)
top = 320;
draw_button(left,top);
}
if (kbhit())
{
if (getkey() == 1)
exit(EXIT_SUCCESS);
}
}
}
int getkey()
{
i.h.ah = 0;
int86(22,&i,&o);
return( o.h.ah );
}
main()
{
initialize();
get_input();
return 0;
}
setcolor(RED);
settextstyle(SCRIPT_FONT, HORIZ_DIR, 4);
outtextxy(midx-150, midy+100, "Press any key to exit...");
getch();
closegraph();
return 0;
}
Magic number:
/* ----------------------------------
You have to think a number between 1-55 and tell whether the number has
appeared in following six lists in y/n. Then this program tells the
number which has been thought.
In case you get a false result that means that either number doesn't
lie between 1-55 or some mistakes have been committed in answering y/n.
So Please check again.
In case of any trouble shoot ups or comments about this program please
feel free to contact me on e-mail
------------------------------ */
#include <stdio.h>
#include <graphics.h>
#include <dos.h>
#include <string.h>
void InitGraphicMode();
void Welcome();
void StartGame();
void DisplayName(int );
void Clear();
void main()
{
InitGraphicMode();
Welcome();
getch();
StartGame();
closegraph();
}
void InitGraphicMode()
{
int gdriver = DETECT, gmode, errorcode;
//In next line the path of bgi files is taken
initgraph(&gdriver, &gmode, "c:\tc\bgi");
errorcode = graphresult();
}
}
//to print the welcome screen
void Welcome()
{
char pattern[8] = {0x00, 0x70, 0x20, 0x27, 0x00, 0x27, 0x20, 0x70};
int i;
setfillpattern(pattern, BLUE);
for(i=0;i<=320;i++)
{
bar(320-i,240-i*0.75,320+i,240+i*0.75);
delay ( 1 ) ;
}
settextjustify(1,1);
DisplayName(100);
settextstyle(5,0,4);
outtextxy(100,300,"By :-");
settextstyle(7,0,6);
setcolor(14);
outtextxy(320,350,"ACHIN SAXENA");
music();
delay(3);
}
//to Start the game
void StartGame()
{
void FirstScreen();
char
ShowList1(),ShowList2(),ShowList3(),ShowList4(),ShowList5(),ShowList6();
int FindNumber(long);
long check(char);
int number,i;
long num=0;
char val;
char ch;
char numstr[10];
while(1)
{
Clear();
music();
FirstScreen();
Clear();
music();
val=ShowList1();
num=check(val);
Clear();
music();
val=ShowList2();
num=num*10+check(val);
Clear();
music();
val=ShowList3();
num=num*10+check(val);
Clear();
music();
val=ShowList4();
num=num*10+check(val);
Clear();
music();
val=ShowList5();
num=num*10+check(val);
Clear();
music();
val=ShowList6();
num=num*10+check(val);
number=FindNumber(num);
itoa(number,numstr,10);
Clear();
music();
settextstyle(5,0,4);
settextjustify(0,1);
if (number)
{
outtextxy(100,150,"So the number you thought
was...");
setcolor(14);
settextstyle(4,0,15);
settextjustify(1,1);
outtextxy(320,250,numstr);
setcolor(15);
settextstyle(6,0,4);
outtextxy(320,350,"Can't believe it .........");
}
else
{
setcolor(14);
outtextxy(100,180,"Your number is out of range ...");
outtextxy(200,260,"OR....");
outtextxy(100,340,"You did not answer properly !!! ");
}
settextjustify(1,1);
settextstyle(6,0,4);
setcolor(CYAN);
{
setcolor(i+2);
outtextxy(40+i*45,ycor, name[i]);
}
}
void Clear()
{
setfillstyle(8,BLUE);
bar(0,0,640,480);
DisplayName(30);
}
//Displaying the first Game Screen
void FirstScreen()
{
settextjustify(1,1);
setcolor(2);
settextstyle(1,0,4);
outtextxy(320,150," Think of any number in the range ");
setcolor(14);
settextstyle(4,0,8);
outtextxy(320,250,"1 - 55");
settextstyle(5,0,3);
setcolor(CYAN);
outtextxy(320,350,"Press any key to continue ......");
setcolor(15);
settextstyle(3,0,3);
outtextxy(320,430,"And Please... Be Honest !!!!!");
getch();
}
//Displaying the six lists
char ShowList1()
{
char ch;
setcolor(14);
settextstyle(3,0,4);
settextjustify(0,1);
outtextxy(70,120,"1, 3, 4, 7, 8, 11, 12");
outtextxy(70,180,"14, 16, 17, 18, 19, 20");
outtextxy(70,240,"24, 25, 28, 30, 31, 33");
outtextxy(70,300,"35, 37, 40, 42, 44, 46");
outtextxy(70,360,"47, 48, 50, 52, 54, 55");
settextstyle(5,0,3);
setcolor(2);
outtextxy(30,420,"Does Your number appear here ? (y/n)...");
ch=getch();
fflush(stdin);
if (ch=='y'||ch=='Y')
outtextxy(500,420,"Y");
else
outtextxy(500,420,"N");
getch();
return(ch);
}
char ShowList2()
{
char ch;
setcolor(14);
settextstyle(3,0,4);
settextjustify(0,1);
outtextxy(70,120,"1, 3, 6, 8, 10, 11, 12");
outtextxy(70,180,"15, 17, 18, 19, 22, 23");
outtextxy(70,240,"26, 29, 31, 32, 33, 34");
outtextxy(70,300,"36, 37, 38, 41, 44, 45");
outtextxy(70,360,"47, 50, 51, 53, 54, 55");
settextstyle(5,0,3);
setcolor(2);
outtextxy(30,420,"How about here ? (y/n)...");
ch=getch();
fflush(stdin);
if (ch=='y'||ch=='Y')
outtextxy(500,420,"Y");
else
outtextxy(500,420,"N");
getch();
return(ch);
char ShowList3()
{
char ch;
setcolor(14);
settextstyle(3,0,4);
settextjustify(0,1);
outtextxy(70,120,"1, 2, 5, 6, 7, 10");
outtextxy(70,180,"11, 13, 15, 16, 17, 19");
outtextxy(70,240,"21, 22, 24, 26, 27, 28");
outtextxy(70,300,"32, 35, 38, 40, 44, 46");
outtextxy(70,360,"47, 48, 49, 53, 54, 55");
settextstyle(5,0,3);
setcolor(2);
outtextxy(30,420,"Now here ? (y/n)...");
ch=getch();
if (ch=='y'||ch=='Y')
outtextxy(500,420,"Y");
else
outtextxy(500,420,"N");
fflush(stdin);
getch();
return(ch);
}
char ShowList4()
{
char ch;
setcolor(14);
settextstyle(3,0,4);
settextjustify(0,1);
outtextxy(70,120,"1, 2, 5, 9, 13, 17, 18");
outtextxy(70,180,"20, 22, 25, 26, 28, 30");
outtextxy(70,240,"31, 32, 33, 35, 36, 37");
outtextxy(70,300,"38, 39, 40, 41, 42, 43");
outtextxy(70,360,"45, 46, 49, 51, 54, 55");
settextstyle(5,0,3);
setcolor(2);
outtextxy(30,420,"And here ? (y/n)...");
ch=getch();
fflush(stdin);
if (ch=='y'||ch=='Y')
outtextxy(500,420,"Y");
else
outtextxy(500,420,"N");
getch();
return(ch);
}
char ShowList5()
{
char ch;
setcolor(14);
settextstyle(3,0,4);
settextjustify(0,1);
outtextxy(70,120," 4, 5, 8, 9, 10");
outtextxy(70,180,"11, 12, 13, 14, 15, 16");
outtextxy(70,240,"19, 21, 24, 27, 29, 30");
outtextxy(70,300,"32, 33, 34, 37, 38, 40");
outtextxy(70,360,"42, 45, 46, 51, 54, 55");
settextstyle(5,0,3);
setcolor(2);
outtextxy(30,420,"And here ? (y/n)...");
fflush(stdin);
ch=getch();
if (ch=='y'||ch=='Y')
outtextxy(500,420,"Y");
else
outtextxy(500,420,"N");
getch();
return(ch);
}
char ShowList6()
{
char ch;
setcolor(14);
settextstyle(3,0,4);
settextjustify(0,1);
outtextxy(70,120," 2, 3, 6, 7, 9");
outtextxy(70,180,"12, 13, 14, 15, 17, 19");
outtextxy(70,240,"23, 24, 25, 26, 27, 31");
outtextxy(70,300,"34, 35, 37, 38, 41, 42");
outtextxy(70,360,"43, 46, 47, 51, 52, 55");
settextstyle(5,0,3);
setcolor(2);
outtextxy(30,420,"Finally here ? (y/n)...");
ch=getch();
fflush(stdin);
if (ch=='y'||ch=='Y')
outtextxy(500,420,"Y");
else
outtextxy(500,420,"N");
getch();
return(ch);
}
int FindNumber(long num)
{
switch(num)
{
case 111100
: return (1);
case 1101
: return (2);
case 110001
: return (3);
case 100010
: return (4);
case 1110
: return (5);
case 11001
: return (6);
case 101001
: return (7);
case 110010
: return (8);
case 111
: return (9);
case 11010
: return(10);
case 111010
: return(11);
case 110011
: return(12);
case 1111
: return(13);
case 100011
: return(14);
case 11011
: return(15);
case 101010
: return(16);
case 111101
: return(17);
case 110100
: return(18);
case 111011
: return(19);
case 100100
: return(20);
case 1010
: return(21);
case 11100
: return(22);
case 10001
: return(23);
case 101011
: return(24);
case 100101
: return(25);
case 11101
: return(26);
case 1011
: return(27);
case 101100
: return(28);
case 10010
: return(29);
case 100110
: return(30);
case 110101
: return(31);
case 11110
: return(32);
case 110110
: return(33);
case 10011
: return(34);
case 101101
: return(35);
case 10100
: return(36);
case 110111
: return(37);
case 11111
: return(38);
case 100
: return(39);
case 101110
: return(40);
case 10101
: return(41);
case 100111
: return(42);
case 101
: return(43);
case 111000
: return(44);
case 10110
: return(45);
case 101111
: return(46);
case 111001
: return(47);
case 101000
: return(48);
case 1100
: return(49);
case 110000
: return(50);
case 10111
: return(51);
case 100001
: return(52);
case 11000
: return(53);
case 111110
: return(54);
case 111111
: return(55);
default
: return(0);
}
}
music()
{
int i ;
float octave[7] = { 130.81, 146.83, 164.81, 174.61, 196, 220, 246.94 } ;
for ( i = 0 ; i < 7 ; i++ )
{
sound ( octave[i] * 8 ) ;
delay ( 30 ) ;
}
nosound();
}
Analog clock:
#include<graphics.h>
#include<conio.h>
#include<math.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm;
int x=320,y=240,r=200,i,h,m,s,thetamin,thetasec;
struct time t;
char n[12][3]={"3","2","1","12","11","10","9","8","7","6","5","4"};
initgraph(&gd,&gm,"f:\arun\tc");\put the directory which contains
egavga.bgi
circle(x,y,210);
setcolor(4);
settextstyle(4,0,5);
for(i=0;i<12;i++)
{
if(i!=3)
outtextxy(x+(r-14)*cos(M_PI/6*i)-10,y-(r-14)*sin(M_PI/6*i)-26,n[i]);
else
outtextxy(x+(r-14)*cos(M_PI/6*i)-20,y-(r-14)*sin(M_PI/6*i)-26,n[i]);
}
gettime(&t);
h=abs(t.ti_hour-3);
else
h=15-t.ti_hour;
m=t.ti_min;
if(t.ti_min<=15)
thetamin=(15-t.ti_min)*6;
else
thetamin=450-t.ti_min*6;
if(t.ti_sec<=15)
thetasec=(15-t.ti_sec)*6;
else
thetasec=450-t.ti_sec*6;
setcolor(4);
line(x,y,x+(r-110)*cos(M_PI/6*h-((m/2)*(M_PI/180))),y-(r-110)*sin(M_PI/6*h
-((m/2)*(M_PI/180))));
circle(x+(r-130)*cos(M_PI/6*h-((m/2)*(M_PI/180))),y-(r-130)*sin(M_PI/6*h-(
(m/2)*(M_PI/180))),10);
line(x,y,x+(r-60)*cos(thetamin*(M_PI/180)),y-(r-60)*sin(thetamin*(M_PI/180
)));
circle(x+(r-80)*cos(thetamin*(M_PI/180)),y-(r-80)*sin(thetamin*(M_PI/180))
,10);
setcolor(15);
line(x,y,x+(r-70)*cos(thetasec*(M_PI/180)),y-(r-70)*sin(thetasec*(M_PI/180
)));
delay(1000);
setcolor(0);
line(x,y,x+(r-70)*cos(thetasec*(M_PI/180)),y-(r-70)*sin(thetasec*(M_PI/180
)));
}
}
Micky mouse:
#include<graphics.h>
#include<dos.h>
#include<conio.h>
#include<alloc.h>
void *buf;
void firstleft();
void secondleft();
void main()
{
int gd=DETECT,gm,i=0,x,y,area;
initgraph(&gd,&gm,"tc:\bgi");\put your directory contains egavga.bgi
rectangle(0,0,getmaxx(),getmaxy());
arc(240,120,40,140,70);
ellipse(165,80,10,280,20,20);
ellipse(315,80,-100,170,20,20);
arc(235,120,163,215,70);
arc(245,120,-35,17,70);
ellipse(193,178,85,280,40,20);
ellipse(283,178,-100,95,40,20);
ellipse(238,199,180,0,39,50);
ellipse(213,123,44,240,33,40);
ellipse(262,123,-60,135,33,40);
ellipse(210,123,0,360,13,20);//left eye
ellipse(265,123,0,360,13,20);//right eye
ellipse(210,133,0,360,10,10);//left eye ball
ellipse(265,133,0,360,10,10);//right eye ball
ellipse(210,133,0,360,3,3);//left eye ball
ellipse(265,133,0,360,3,3);//right eye ball
ellipse(238,160,0,360,10,13);//nose
arc(240,125,228,312,68);//mouth
arc(240,120,230,310,72);//mouth
setfillstyle(1,4);
floodfill(238,160,15);//nose
setfillstyle(1,15);
floodfill(210,113,15);
floodfill(265,113,15);
setfillstyle(1,9);
floodfill(210,100,15);
setfillstyle(1,1);
floodfill(315,80,15);
moveto(203,220);
lineto(203,260);
lineto(183,260);
lineto(183,350);
lineto(293,350);
lineto(293,260);
lineto(273,260);
lineto(273,220);
moveto(183,350);
lineto(173,460);
lineto(213,460);
lineto(238,400);
lineto(263,460);
lineto(303,460);
lineto(293,350);
moveto(173,460);
lineto(143,478);
lineto(213,478);
lineto(213,460);
moveto(263,460);
lineto(263,478);
lineto(333,478);
lineto(303,460);
line(238,400,238,350);
//right hand
moveto(183,260);
lineto(113,310);
lineto(183,375);
moveto(183,280);
lineto(137,310);
lineto(181,353);
setfillstyle(2,13);
floodfill(190,300,15);
setfillstyle(1,5);
floodfill(223,400,15);
setfillstyle(1,5);
floodfill(253,400,15);
setfillstyle(1,6);
floodfill(173,470,15);
floodfill(303,470,15);
//fingers
secondleft();
ellipse(413.5,228,0,180,3.5,3.5);
line(420,240,433,240);
line(423,247,440,247);
line(413,240,410,228);
line(417,228,420,240);
ellipse(433,243.5,-90,90,3.5,3.5);
line(423,254,440,254);
ellipse(440,250.5,-90,90,3.5,3.5);
ellipse(430,257,-90,90,3,3);
line(413,260,430,260);
area=imagesize(409,224,444,261);
buf=malloc(area);
getimage(409,224,444,261,buf);
while(!kbhit())
{
if(i==0)
{
setfillstyle(1,15);
setcolor(15);
ellipse(210,133,0,360,10,10);//left eye ball
ellipse(265,133,0,360,10,10);//right eye ball
setcolor(0);
ellipse(210,133,0,360,3,3);//left eye ball
ellipse(265,133,0,360,3,3);//right eye ball
floodfill(210,133,15);
floodfill(265,133,15);
setcolor(0);
putimage(391,209,buf,1);
firstleft();
setcolor(15);
secondleft();
putimage(409,224,buf,0);
i=1;
}
else
{
setfillstyle(1,0);
setcolor(0);
ellipse(210,133,0,360,10,10);//left eye ball
ellipse(265,133,0,360,10,10);//right eye ball
floodfill(210,133,0);
floodfill(265,133,0);
setcolor(15);
ellipse(210,133,0,360,3,3);//left eye ball
ellipse(265,133,0,360,3,3);//right eye ball
floodfill(210,133,15);
floodfill(265,133,15);
setcolor(0);
putimage(409,224,buf,1);
secondleft();
setcolor(15);
firstleft();
putimage(391,209,buf,0);
i=0;
}
delay(300);
}
getch();
}
void firstleft()
{
moveto(293,260);
lineto(353,276);
lineto(395,223);
moveto(293,280);
lineto(355,296);
lineto(395,245);
}
void secondleft()
{
moveto(293,260);
lineto(363,280);
lineto(413,240);
moveto(293,280);
lineto(363,300);
lineto(413,260);
}