How to Make Happy new year project 2020 in turbo c, c++ with source code
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
//function prototype declaration
int circles_full(int max, int may);
int corners(int maxx,int maxy);
int eraser(int maxx,int maxy);
int text_float(int maxx,int maxy);
int text_float1(int maxx,int maxy);
int circles_half(int maxx,int maxy);
int rect(int maxx, int maxy);
int flower_circles(int maxx,int maxy);
int text_float2(int maxx,int maxy);
int circ(int maxx, int maxy);
int circle_sides(int maxx,int maxy);
int i,k;
void main()
{
int grd=DETECT, grm,maxx,maxy,errorcode;
initgraph(&grd,&grm,"c:\\turboc3\\bgi");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk)
/* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
/* terminate with an error code */
}
maxx=getmaxx(); /*Getting the coordinates of the screen*/
maxy=getmaxy();
/* pattern 1*/
circles_full(maxx,maxy);
cleardevice();
setbkcolor(6);
corners(maxx,maxy);
text_float(maxx,maxy);
circle_sides(maxx,maxy);
delay(3000);
eraser(maxx,maxy);
cleardevice();
setbkcolor(0);
/* pattern 2*/
rect(maxx,maxy);
cleardevice();
setbkcolor(5);
corners(maxx,maxy);
text_float1(maxx,maxy);
flower_circles(maxx,maxy);
circle_sides(maxx,maxy);
delay(3000);
cleardevice();
setbkcolor(0);
/*pattern 3*/
circles_half(maxx,maxy);
cleardevice();
setbkcolor(6);
text_float2(maxx,maxy);
corners(maxx,maxy);
circ(maxx,maxy);
flower_circles(maxx,maxy);
getch();
closegraph(); /*Closing the graphics system */
}
//*************************************************************
//This function display blinking circles
int circ(int maxx,int maxy)
{
for(i=0;i<5;i++)
{
setcolor(0);
circle(100,maxy/2+50,10);
setcolor(0);
circle(maxx-100,maxy/3,15);
setcolor(0);
setfillstyle(SOLID_FILL,0);
circle(maxx/2,maxy-50,30);
floodfill(maxx/2,maxy-50,0);
delay(200);
setcolor(5);
circle(100,maxy/2+50,10);
setcolor(3);
circle(maxx-100,maxy/3,15);
setcolor(4);
setfillstyle(SOLID_FILL,4);
circle(maxx/2,maxy-50,30);
floodfill(maxx/2,maxy-50,4);
delay(200);
}
return 0;
}
//*************************************************************
//Printing text pattern 1
int text_float(int maxx,int maxy)
{
for(i=0;i<maxy/3;i++)
{
settextstyle(7,0,7); /*font direction size*/
setcolor(1);
outtextxy(maxx/3+30,i,"GOOD");
delay(10);
setcolor(0);
outtextxy(maxx/3+30,i,"GOOD");
}
setcolor(1);
outtextxy(maxx/3+30,i,"GOOD");
for(i=0;i<maxx/3+35;i++)
{
settextstyle(7,0,7); /*font direction size*/
setcolor(1);
outtextxy(i,maxx/3,"BYE");
delay(10);
setcolor(0);
outtextxy(i,maxx/3,"BYE");
}
setcolor(1);
outtextxy(i,maxx/3,"BYE");
for(i=maxx;i>maxx/3+30;i--)
{
settextstyle(7,0,7); /*font direction size*/
setcolor(1);
outtextxy(i,maxx/3+50,"2017");
delay(10);
setcolor(0);
outtextxy(i,maxx/3+50,"2017");
}
setcolor(1);
outtextxy(i,maxx/3+50,"2017");
return 0;
}
//**************************************************************
//Printing text pattern 2
int text_float1(int maxx,int maxy)
{
for(i=0;i<maxx/3+80;i++)
{
settextstyle(7,0,7); /*font direction size*/
setcolor(1);
outtextxy(i,maxx/3,"TO");
delay(10);
setcolor(0);
outtextxy(i,maxx/3,"TO");
}
setcolor(1);
outtextxy(i,maxx/3,"TO");
for(i=0;i<maxy/3;i++)
{
settextstyle(7,0,7); /*font direction size*/
setcolor(1);
outtextxy(maxx/3-50,i,"WELCOME");
delay(10);
setcolor(0);
outtextxy(maxx/3-50,i,"WELCOME");
}
setcolor(1);
outtextxy(maxx/3-50,i,"WELCOME");
for(i=maxx;i>maxx/3+30;i--)
{
settextstyle(7,0,7); /*font direction size*/
setcolor(1);
outtextxy(i,maxx/3+50,"2018");
delay(10);
setcolor(0);
outtextxy(i,maxx/3+50,"2018");
}
setcolor(1);
outtextxy(i,maxx/3+50,"2018");
return 0;
}
//************************************************************
// Printing the text pattern 3
int text_float2(int maxx,int maxy)
{
for(i=0;i<maxx/3-30;i++)
{
settextstyle(7,0,7); /*font direction size*/
setcolor(1);
outtextxy(i,maxx/3-50,"HAPPY");
delay(10);
setcolor(0);
outtextxy(i,maxx/3-50,"HAPPY");
}
setcolor(1);
outtextxy(i,maxx/3-50,"HAPPY");
for(i=0;i<maxy/3-60;i++)
{
settextstyle(7,0,7); /*font direction size*/
setcolor(1);
outtextxy(maxx/3-100,i,"BIGTRUE");
delay(10);
setcolor(0);
outtextxy(maxx/3-100,i,"BIGTRUE");
}
setcolor(1);
outtextxy(maxx/3-100,i,"BIGTRUE");
for(i=maxx;i>maxx/3+30;i--)
{
settextstyle(7,0,7); /*font direction size*/
setcolor(1);
outtextxy(i,maxx/3+20,"NEW YEAR");
delay(10);
setcolor(0);
outtextxy(i,maxx/3+20,"NEW YEAR");
}
setcolor(1);
outtextxy(i,maxx/3+20,"NEW YEAR");
for(i=0;i<180;i++)
{
settextstyle(7,0,7);
setcolor(1);
outtextxy(maxx/2,maxy-i,"2018");
setcolor(0);
outtextxy(maxx/2,maxy-i,"2018");
}
setcolor(1);
outtextxy(maxx/2,maxy-i,"2018");
return 0;
}
//*********************************************************
//Printing rectangular pattern
int rect(int maxx,int maxy)
{
int p,j,i1,j1;
for(p=0;p<5;p++)
{
for(i=0;i<maxx/2;i+=2)
{
setcolor(5+p);
rectangle(i,i,maxx-i,maxy-i);
delay(10);
}
i1=maxx-i;
j1=maxy-i;
j=0;
setcolor(0+p);
for(k=i;k>2;k-=2)
{
j+=2;
rectangle(k-2,k-2,i1+j,j1+j);
delay(10);
}
}
return 0;
}
//*******************************************************
//printing the half circles pattern 2
int circles_half(int maxx,int maxy)
{
int k=0,col,s;
for(col=1;col<8;col++)
{
setcolor(col);
for(i=4;i<maxx/2-250;i+=2)
{
k+=2;
circle(maxx/2,maxy/2,k);
delay(10);
}
s=k;
setcolor(col+2);
for(i=4;i<maxx/2-250;i+=2)
{
s-=2;
circle(maxx/2,maxy/2,s);
delay(10);
}
}
return 0;
}
//*************************************************************
//function prints the full size circles pattern
int circles_full(int max, int may)
{
int s,col;
for(col=1;col<7;col++)
{
k=0;
setcolor(col);
for(i=4;i<max/2;i+=2)
{
k+=2;
circle(max/2,may/2,k);
delay(10);
}
s=k;
setcolor(col+2);
for(i=4;i<max/2;i+=2)
{
s-=2;
circle(max/2,may/2,s);
delay(10);
}
}
return 0;
}
//*********************************************************
//printing a pattern on the 4 corners of the screen
int corners(int maxx,int maxy)
{
for(i=0;i<6;i++)
{
setfillstyle(1,i+1);
pieslice(1,maxy,15*i,15*(i+1),100);
setcolor(8);
delay(200);
}
for(i=0;i<6;i++)
{
setfillstyle(1,i+1);
pieslice(1,1,15*(18+i),15*(i+19),100);
setcolor(8);
delay(200);
}
for(i=0;i<6;i++)
{
setfillstyle(1,i+1);
pieslice(maxx,1,15*(12+i),15*(i+13),100);
setcolor(8);
delay(200);
}
for(i=0;i<6;i++)
{
setfillstyle(1,i+1);
pieslice(maxx,maxy,15*(6+i),15*(i+7),100);
setcolor(8);
delay(200);
}
return 0;
}
//*****************************************************
//This function erases the elements present on the screen
int eraser(int maxx,int maxy)
{
int j;
for(i=0;i<10;i++)
{
if(i%2==0)
{
for(j=0;j<maxx-30;j+=5)
{
setfillstyle(1,5);
bar(j,i*50,j+40,(i*50)+60);
/*left top right bottom*/
delay(10);
setfillstyle(1,0);
bar(j,i*50,j+40,(i*50)+60);
}
}
else
{
for(j=maxx;j>30;j-=5)
{
setfillstyle(1,5);
bar(j,i*50,j-40,(i*50)+60);
delay(10);
setfillstyle(1,0);
bar(j,i*50,j-40,(i*50)+60);
}
}
}
setfillstyle(1,5);
bar(j,i*50,j+40,(i*50)+60);
return 0;
}
//*****************************************************
//Printing the moving circles above the text
int flower_circles(int maxx,int maxy)
{
for(i=0;i<35;i++)
{
setcolor(3);
circle(maxx/2,i*3,5);
circle(maxx/2+(i*2),i*3,5);
circle(maxx/2-(i*2),i*3,5);
circle(maxx/2-(i*5),i*3,5);
circle(maxx/2+(i*5),i*3,5);
delay(100);
setcolor(0);
circle(maxx/2,i*3,5);
circle(maxx/2+(i*2),i*3,5);
circle(maxx/2-(i*2),i*3,5);
circle(maxx/2-(i*5),i*3,5);
circle(maxx/2+(i*5),i*3,5);
}
setcolor(3);
circle(maxx/2,i*3,5);
circle(maxx/2+(i*2),i*3,5);
circle(maxx/2-(i*2),i*3,5);
circle(maxx/2-(i*5),i*3,5);
circle(maxx/2+(i*5),i*3,5);
return 0;
}
//******************************************************
//Function used to print 4 circles in 4 sides of the text
int circle_sides(int maxx,int maxy)
{
setcolor(2);
setfillstyle(SOLID_FILL,3);
circle(maxx/2,maxy/2-200,30);
floodfill(maxx/2,maxy/2-200,2);
delay(100);
setcolor(4);
setfillstyle(SOLID_FILL,2);
circle(maxx/2,maxy/2+200,30);
floodfill(maxx/2,maxy/2+200,4);
delay(100);
setcolor(3);
setfillstyle(SOLID_FILL,1);
circle(maxx/2-200,maxy/2,30);
floodfill(maxx/2-200,maxy/2,3);
delay(100);
setcolor(1);
setfillstyle(SOLID_FILL,4);
circle(maxx/2+200,maxy/2,30);
floodfill(maxx/2+200,maxy/2,1);
delay(100);
return 0;
}
0 comments:
Post a Comment