Displaying Source Code(s)
|
|
--------------------------------------------------------------------------------
Cool Graphics Stuff (Mini Project)
--------------------------------------------------------------------------------
Description : This is a cool graphics program.You just relax and
see this cool stuff.
Code :
#include<dos.h>
#include<graphics.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void graph1();
void graph2();
void graph3();
void main()
{
clrscr();
graph1();
delay(300);
graph2();
delay(300);
graph3();
getch();
}
void graph1()
{ int j=10,n=0;
char str[]="HEY GUYS,COMING AHEAD IS SOME COOL
G R A P H I C S S T U F F ";
clrscr();
while(n<strlen(str))
{
textcolor(14);
gotoxy(j,12);
cprintf("%c",str[n]);
j=j+2;
n++;
delay(200);
}
}
void graph2()
{ int gdriver = DETECT, gmode,errorcode,i,j,k,l;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s<BR>, grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
cleardevice();
setcolor(10);
setlinestyle(3,2,3);
rectangle(65,10,555,475);
setcolor(12);
rectangle(70,15,550,470);
setlinestyle(0,1,1);
for(i=0,j=220;i<225||j>100;i=i+2,j=j-2)
{
setcolor(i-1);
arc(310,240,0,360,i);
setcolor(j+2);
arc(310,240,0,360,j);
delay(130);
}
delay(1500);
for(i=0;i<200;i++)
{ setcolor(14);
arc(310,240,0,360,i);
delay(50);
setcolor(0);
arc(310,240,0,360,i);
}
delay(1500);
for(i=170,j=100,k=450,l=380;i<400,j<400,k>80,l>110;i=i+3,j=j+3,k=k-3,l=l-3
)
{ setcolor(i);
rectangle(i,j,k,l);
delay(250);
}
delay(300);
for(i=170,j=100,k=450,l=380;i<310,j<240,k>310,l>240;i=i+2,j=j+2,k=k-2,l=l-
2)
{ setcolor(0);
rectangle(i,j,k,l);
delay(150);
}
delay(200);
for(i=170,j=100,k=450,l=380;i<310,j<240,k>310,l>240;i=i+1,j=j+1,k=k-1,l=l-
1)
{ setcolor(0);
rectangle(i,j,k,l);
delay(80);
}
delay(1500);
setcolor(14);
settextstyle(1,0,1);
moveto(180,190);
outtext("I Know you enjoyed the show");
delay(1000);
moveto(210,260);
outtext("No need to thank me ....");
getch();
closegraph();
}
void graph3()
{ int i=20,j=7,n1=0,n2=0;
char str1[]="BYE FOR NOW FOLKS....";
char str2[]="Tell me how do you like it at my e-mail id :
sahilguy_2004@yahoo.co.in";
clrscr();
while(n1<strlen(str1))
{ textcolor(10);
gotoxy(i,12);
cprintf("%c",str1[n1]);
i=i+2;
n1++;
delay(250);
}
delay(200);
while(n2<strlen(str2))
{ textcolor(13);
gotoxy(j,22);
cprintf("%c",str2[n2]);
j++;
n2++;
delay(100);
}
}
|
|
|