Exp 10.c

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include<graphics.

h>
#include<stdio.h>
#include<conio.h>
int gdriver=DETECT,gmode;
int x1,y1,x2,y2,dep,ch;
void main()
{
printf("Enter Top Left and Bottom right corner");
printf("\nEnter x1 coordinate:");
scanf("%d",x1);
printf("Enter y1 coordinate:");
scanf("%d",y1);
printf("Enter x2 coordinate:");
scanf("%d",x2);
printf("Enter y2 coordinate:");
scanf("%d",y2);
printf("Enter depth along z-axis:");
scanf("%d",dep);
printf("Choose and one projection\n\t1.Parallel Projection\n\t2.Perspective
Projection\nEnter your choice:");
scanf("%d",ch);
initgraph(&gdriver,&gmode,"C:\\TURBOC3\\BGI");
switch(ch)
{
case 1:
rectangle(x1,y1,x2,y2);
outtextxy(x1,y1-10,"Front View");
rectangle(x2+100,y1,x2+100+dep,y2);
outtextxy(x2+100,y1-10,"Side View");
rectangle(x1,y1-(y2-y1),x2,x1+dep-(y2-y1));
outtextxy(x2+100,y1-10,"Top View");
getch();
closegraph();
break;
case 2:
bar3d(x1,y1,x2,y2,dep,1);
getch();
closegraph();
break;
}
}

You might also like