You are on page 1of 9

#include<stdio.

h>
#include<conio.h>
#include<ctype.h>
#include<graphics.h>
#include<stdlib.h>
int a,b,i,j;
char ch;
first()
{
setcolor(15);
setfillstyle(1,1);
bar(0,0,615,15);
settextstyle(0,0,1);
outtextxy(35,4,"ADDYDEEP MENU-BASED C PROGRAM ON GRAPHICS");
setfillstyle(1,8);
bar(0,15,615,30);
setcolor(11);
settextstyle(2,HORIZ_DIR,5);
outtextxy(26,15,"F");
outtextxy(60,15,"H");
setcolor(15);
settextstyle(2,HORIZ_DIR,4);
outtextxy(34,17,"ILE");
outtextxy(68,17,"ELP");
setcolor(0);
line(55,15,55,30);
line(90,15,90,30);
return;
}
void main()
{
int x,y;
int gm,gd=DETECT,errcode;
clrscr();
initgraph(&gd,&gm,"C:/TC/BGI");
errcode=graphresult();
if(errcode!=grOk)
{
printf("Graphics error %s\n",grapherrormsg(errcode));
printf("Press any key to halt\n");
getch();
exit(0);
}
x=getmaxx()/3;
y=getmaxy()/3;
start:
do
{
first();
ch=getche();
a=toascii(ch);
file:
if(a==102)
{
clearviewport();
first();
setfillstyle(1,8);
bar(10,32,55,80);
setcolor(11);
settextstyle(2,HORIZ_DIR,5);
outtextxy(20,35,"O");
outtextxy(20,60,"E");
setcolor(15);
settextstyle(2,HORIZ_DIR,4);
outtextxy(28,37,"PEN");
outtextxy(28,62,"XIT");
ch=getche();
a=toascii(ch);
if(a==111)
{
cleardevice();
goto enter;
}
if(a==101)
{
delay(500);
closegraph();
exit(0);
}
if(a==104)
{
goto help;
}
}
help:
if(a==104)
{
clearviewport();
first();
setfillstyle(1,8);
bar(56,32,135,80);
setcolor(11);
settextstyle(2,HORIZ_DIR,5);
outtextxy(63,35,"A");
outtextxy(63,60,"P");
setcolor(15);
settextstyle(2,HORIZ_DIR,4);
outtextxy(70,37,"BOUT ME");
outtextxy(70,62,"LEASE HELP");
ch=getche();
a=toascii(ch);
if(a==97)
{
clearviewport();
first();
setcolor(15);
rectangle(150,150,420,300);
outtextxy(200,160,"ABOUT ADARSHA KHAREL");
outtextxy(160,180,"Hello ! and welcome to all of my users.");
outtextxy(155,195,"I am Adarsha Kharel, a student of Computer");
outtextxy(155,210,"Science in C.C.C.T, Chisopani. I have ");
outtextxy(155,225,"developed this C program to show that we can");
outtextxy(155,240,"do anything we want if we have the faith in us.");
outtextxy(200,270,"Thank You");
ch=getche();
a=toascii(ch);
if(a!=27)
{
clearviewport();
goto start;
}
else
{
delay(500);
closegraph();
exit(0);
}
}
if(a==112)
{
clearviewport();
first();
setcolor(10);
rectangle(150,150,420,300);
outtextxy(200,160,"ABOUT THIS PROGRAM");
outtextxy(160,180,"Hello ! and welcome to all of my users.");
outtextxy(155,195,"This programming technique is based on");
outtextxy(155,210,"the graphical reference library of C. We");
outtextxy(155,225,"can develop thes type of softwares using C");
outtextxy(155,240,"if we want to and if we have the goal in us.");
outtextxy(200,270,"Thank You");
ch=getche();
a=toascii(ch);
if(a!=27)
{
clearviewport();
goto start;
}
else
{
delay(500);
closegraph();
exit(0);
}
}
if(a==102)
{
goto file;
}
}
if(a==27)
{
delay(500);
closegraph();
exit(0);
}
if(a!=102 || a!=104 || a!=27)
{
goto start;
}
}
while(a!=13);
clearviewport();
goto start;
enter:
setbkcolor(6);
setfillstyle(1,15);
setcolor(5);
bar(140,120,480,350);
settextstyle(4,HORIZ_DIR,1);
outtextxy(145,115,"Welcome to AddyDeep's C Program Magic");
line(140,140,480,140);
outtextxy(200,200,"Press Enter to continue");
outtextxy(165,230,"or any other key to exit the program");
settextstyle(2,HORIZ_DIR,5);
outtextxy(160,280,"**Press F to give the feedback**");
settextstyle(2,HORIZ_DIR,4);
outtextxy(170,335,"Developed and Programmed By Adarsha Kharel");
ch=getche();
a=toascii(ch);
if(a==13)
{
cleardevice();
setbkcolor(12);
setfillstyle(4,6);
bar(100,100,500,450);
settextstyle(4,HORIZ_DIR,3);
outtextxy(205,73,"MAGIC IN YOU");
settextstyle(3,HORIZ_DIR,1);
outtextxy(120,150,"Press 1 for star view magic");
outtextxy(120,200,"Press 2 for circular magic 1");
outtextxy(120,250,"Press 3 for circular magic 2");
outtextxy(120,300,"Press 4 to see the Indian National Flag");
outtextxy(120,350,"Press enter to go back to the main menu");
outtextxy(120,400,"Press any other key to exit");
settextstyle(3,VERT_DIR,5);
outtextxy(55,180,"CONTENTS");
settextstyle(2,HORIZ_DIR,5);
outtextxy(300,465,"Developed By Adarsha Kharel");
ch=getche();
a=toascii(ch);
if(a==49)
{
cleardevice();
setbkcolor(0);
line(0,0,640,0);
line(0,0,0,480);
line(639,0,639,480);
line(639,479,0,479);
if(!kbhit())
{
setcolor(15);
setfillstyle(1,15);
pieslice(80,50,140,320,10);
for(i=0;i<=2000;i++)
{
x=rand()%639;
y=rand()%480;
putpixel(x,y,15);
delay(3);
}
}
outtextxy(300,465,"Developed By Adarsha Kharel");
ch=getche();
a=toascii(ch);
if(a==13)
{
clearviewport();
goto enter;
}
else
{
closegraph();
exit(0);
}
}
else if(a==50)
{
cleardevice();
setbkcolor(12);
setcolor(3);
setfillstyle(SOLID_FILL,3);
bar(50, 50, 570, 430);
setfillstyle(1, 14);
bar(100, 100, 525, 380);
outtextxy(300,465,"Developed By Adarsha Kharel");
while(!kbhit())
{
putpixel(random(425)+100, random(279)+101,random(16));
setcolor(random(16));
circle(320,240,random(100));
}
ch=getche();
a=toascii(ch);
if(a==13)
{
clearviewport();
goto enter;
}
else
{
closegraph();
exit(0);
}
}
else if(a==51)
{
cleardevice();
setbkcolor(0);
setcolor(1);
setfillstyle(1,1);
fillellipse(300,250,20,20);
settextstyle(1,HORIZ_DIR,2);
outtextxy(80,70,"Press any key to see the magic");
getch();
for(i=0;i<10;i++)
{
putpixel(300,280-i,14);
putpixel(330-i,250,13);
putpixel(270+i,250,12);
putpixel(300,220+i,11);
delay(20);
}
settextstyle(2,HORIZ_DIR,5);
outtextxy(300,465,"Developed By Adarsha Kharel");
do
{
for(j=0;j<300;j=j+30)
{
setcolor(YELLOW);
circle(300,250,30+j/2);
for(i=0;i<10;i++)
{
putpixel(300,280-j,14);
putpixel(330-j,250,13);
putpixel(270+j,250,12);
putpixel(300,220+j,11);
}
delay(50);
}
clearviewport();
for(j=300;j>0;j=j-30)
{
setcolor(YELLOW);
circle(300,250,30-j/2);
for(i=0;i<10;i++)
{
putpixel(300,280+j,14);
putpixel(330+j,250,13);
putpixel(270-j,250,12);
putpixel(300,220-j,11);
}
delay(50);
}
}
while(!kbhit());
ch=getche();
a=toascii(ch);
if(a==13)
{
clearviewport();
goto enter;
}
else
{
closegraph();
exit(0);
}
}
else if(a==52)
{
cleardevice();
setbkcolor(7);
settextstyle(0,HORIZ_DIR,2);
outtextxy(220,100,"INDIAN NATIONAL FLAG");
settextstyle(2,HORIZ_DIR,4);
outtextxy(300,465,"Developed By Adarsha Kharel");
setfillstyle(1,6);
bar(220,150,420,200);
setfillstyle(1,15);
bar(220,200,420,250);
setfillstyle(1,2);
bar(220,250,420,300);
setfillstyle(6,3);
bar(210,150,220,400);
setfillstyle(1,1);
fillellipse(320,225,20,20);
setcolor(15);
line(300,225,340,225);
line(320,205,320,245);
line(300,220,340,230);
line(300,230,340,220);
line(305,215,335,235);
line(305,235,335,215);
line(310,210,330,240);
line(310,240,330,210);
line(315,245,325,205);
line(315,205,325,245);
ch=getche();
a=toascii(ch);
if(a==13)
{
clearviewport();
goto enter;
}
else
{
closegraph();
exit(0);
}
}
else if(a==13)
{
clearviewport();
goto enter;
}
else
{
cleardevice();
setbkcolor(9);
settextstyle(4,HORIZ_DIR,4);
outtextxy(100,100,"Good Bye...\t\b\n");
settextstyle(3,HORIZ_DIR,4);
outtextxy(120,200,"Phir Milenge..\t\b\n");
settextstyle(1,HORIZ_DIR,4);
outtextxy(140,300,"Chalte Chalte.......\t\b\n");
settextstyle(2,HORIZ_DIR,4);
outtextxy(300,465,"Developed By Adarsha Kharel");
delay(1000);
closegraph();
exit(0);
}
}
else if(a==102)
{
clearviewport();
feedback();
goto enter;
}
else
{
delay(500);
closegraph();
exit(0);
}
}
feedback()
{
char c[100];
setbkcolor(5);
setfillstyle(1,15);
setcolor(5);
bar(140,120,480,350);
settextstyle(4,HORIZ_DIR,1);
outtextxy(145,115,"Please provide me with your feedback");
line(140,140,480,140);
settextstyle(2,0,4);
outtextxy(145,140,"Press enter to finish");
setcolor(15);
settextstyle(2,0,4);
outtextxy(180,400,"Developed and Programmed by Adarsha Kharel");
for(i=0;i<150;i++)
{
ch=getche();
a=toascii(ch);
if(a==13)
{
break;
}
else
{
c[i]=ch;
}
}
clearviewport();
setcolor(2);
rectangle(150,150,450,300);
settextstyle(3,0,2);
outtextxy(155,120,"YOUR FEEDBACK IS:");
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t");
a=30;
for(i=0;i<150;i++)
{
if(i==a)
{
a+=30;
printf("\n\t\t\t");
}
if(c[i]==NULL)
{
break;
}
else
{
printf("%c",c[i]);
}
}
line(150,150,150,300);
settextstyle(2,0,6);
outtextxy(165,320,"Press enter to go back");
outtextxy(160,340,"or any other key to exit");
setcolor(15);
settextstyle(2,0,4);
outtextxy(180,400,"Developed and Programmed by Adarsha Kharel");
ch=getche();
a=toascii(ch);
if(a==13)
{
clearviewport();
return;
}
else
{
delay(500);
closegraph();
exit(0);
}
}