Sunday 12 May 2013

School Management System


#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
int i=1,j=1;
long start_std_id=110000;
long start_stf_id=120000;
void student_available_seat(int);
void student_admit_particular_id(int);
class staff
{
protected:
long stf_id;
char name[10];
int  salary;
int  class_name;
public :
void staff_data();
void staff_display();
}stf[10];
void staff::staff_data()
{
//staff_id=stf_id+j;
stf_id=++start_stf_id;

cout<<"enter staff_name:";
cin>>name;
cout<<"enter salary:";
cin>>salary;
cout<<"enter class_name in integer:";
cin>>class_name;
}
void staff::staff_display()
{
cout<<endl<<"staff_id:";
cout<<stf_id<<endl;
cout<<"staff_name:";
cout<<name<<endl;
cout<<"salary:";
cout<<salary<<endl;
cout<<"class_name:";
cout<<class_name<<endl;
}

class fees
{
public:
int fees_status;
int month_num;
int tution_fees;
int exam_fees;
int transport_fees;
}fees_month[12][4];

class student:public fees
{
public:
long std_id;
char student_name[20];
char parent_name[20];
int  class_name;
char address[50];
char  mobile_num[11];
char addmission_date[10];
public:
void student_data();
void student_display();
void student_fees_pay(int );
void student_fees_status(int);
void student_delete();
void student_fees_delete(int);
void student_data_particular_id(int);
void student_upgrade(int);

}std[10];
void student::student_upgrade(int m)
{

if(std[m].student_name[0]!='\0')
std[m].class_name+=1;
}

void student::student_data()
{
int cname;
std_id=++start_std_id;
int m=std_id-110000;
if(std[m].student_name[0]=='\0')
{
cout<<"enter student_name(length[20]):";
cin>>std[m].student_name;

cout<<"enter class_name in integer(0-12):";
cin>>cname;
if(cname>=0&&cname<=12)
std[m].class_name=cname;
else
cout<<"error in class_name"<<endl;


cout<<"enter parent_name(length[20]):";
cin>>std[m].parent_name;
cout<<"enter mobile_number(length[10]):";
cin>>std[m].mobile_num;
cout<<"enter addmission_date(format[dd/mm/yy]):";
cin>>std[m].addmission_date;
cout<<"enter address(length[50]):";
cin>>std[m].address;
}
}
void student::student_display()
{

cout<<endl<<"student_id:";
cout<<std_id<<endl;
cout<<"student_name:";
cout<<student_name<<endl;
cout<<"class_name:";
cout<<class_name<<endl;
cout<<"parent_name(length[20]):";
cout<<parent_name<<endl;
cout<<"mobile_number(length[10]):";
cout<<mobile_num<<endl;
cout<<"addmission_date(format[dd/mm/yy]):";
cout<<addmission_date<<endl;
cout<<"address(length[50]):";
cout<<address<<endl;
}


void student::student_fees_pay(int a)
{
if(std[a].student_name[0]!='\0')
{
cout<<"jan-dec is equivalent to 1-12:"<<endl;
cout<<"enter digit(1-12):";
cin>>month_num;
cout<<"tution_fees:";
cin>>fees_month[month_num][a].tution_fees;
fees_month[month_num][a].fees_status=1;
student_fees_status(a);
}
else
cout<<"student is not admitted at:"<<a+110000<<endl;
}

void student::student_fees_status(int a)
{
for(int m=1;m<=12;m++)
{
if(fees_month[m][a].fees_status==1)
cout<<"fees of month "<<m<<" is paid......"<<endl;
else
cout<<"fees of month "<<m<<" is due"<<endl;
}
}
void student::student_delete()
{
//std_id=NULL;
for(int m=0;m<20;m++)
{
student_name[m]='\0';
parent_name[m]='\0';
}
class_name=NULL;
for(m=0;m<50;m++)
address[i]='\0';
for(m=0;m<11;m++)
mobile_num[m]='\0';
for(m=0;m<10;m++)
addmission_date[m]='\0';
}
void student::student_fees_delete(int a)
{
for(int i=1;i<=12;i++)
{
fees_month[i][a].fees_status=NULL;
fees_month[i][a].tution_fees=NULL;
fees_month[i][a].exam_fees=NULL;
fees_month[i][a].transport_fees=NULL;
}
}
void student_available_seat(int a)
{
for(int m=1;m<=a;m++)
{
if(std[m].student_name[0]=='\0')
cout<<"std_id: "<<m+110000<<endl;
}
}
void student_admit_particular_id(int a)
{
if(std[a].student_name[0]=='\0')
{
std[a].student_data_particular_id(a);
std[a].student_display();
}
else
cout<<"student is already admitted at this std_id"<<endl;
}
void student::student_data_particular_id(int a)
{
int cname;
std_id=110000+a;
cout<<"enter student_name(length[20]):";
cin>>student_name;

cout<<"enter class_name in integer(0-12):";
cin>>cname;
if(cname>=0&&cname<=12)
std[a].class_name=cname;
else
cout<<"error in class name"<<endl;

cout<<"enter parent_name(length[20]):";
cin>>parent_name;
cout<<"enter mobile_number(length[10]):";
cin>>mobile_num;
cout<<"enter addmission_date(format[dd/mm/yy]):";
cin>>addmission_date;
cout<<"enter address(length[50]):";
cin>>address;
}

void main()
{
int gd=DETECT,gm;
long n,std_id,stf_id;
int m;
long id;
initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
setbkcolor(3);
x:
cleardevice();
cout<<"=============================================="<<endl;
cout<<"                  MENU                        "<<endl;
cout<<"=============================================="<<endl;
cout<<"          Made by saurabh_gupta               "<<endl;
cout<<"     enter [1] for adding new student         "<<endl;
cout<<"     enter [2] for staff                      "<<endl;
cout<<"     enter [3] to get information             "<<endl;
cout<<"     enter [4] for fees payment               "<<endl;
cout<<"     enter [5] for fees status                "<<endl;
cout<<"=============================================="<<endl;
cout<<"     enter [-1] for deleting student          "<<endl;
cout<<"     enter [-2] to see available seat         "<<endl;
cout<<"     enter [-3] to admit student at a particular std_id:"<<endl;
cout<<"     enter [-4] to upgrade students in next class:    "<<endl;
cout<<"     enter [0]  to exit                       "<<endl;
cout<<"=============================================="<<endl;
cout<<"     start_std_id:"<<start_std_id+1<<" start_staff_id"<<start_stf_id+1<<endl;
cout<<"==============================================="<<endl<<"::";
cin>>n;

switch(n)
{
case 1:

std[i].student_data();
//cleardevice();
std[i].student_display();
i++;
cout<<"enter [0] to go back:";
cin>>m;
if(m==0)
goto x;
break;


case 2:

stf[j].staff_data();
cleardevice();
stf[j].staff_display();
j++;
cout<<endl<<"enter [0] to go back:";
cin>>m;
if(m==0)
goto x;
break;

case 3:

cout<<"enter id:";
cin>>id;
if(id>110000&&id<120000)
{
m=id-110000;
std[m].student_display();
}
else
{
m=id-120000;
stf[m].staff_display();
}
cout<<endl<<"enter [0] to go back:";
cin>>m;
if(m==0)
goto x;

case 4:

cout<<"enter id:";
cin>>id;
if(id>110000&&id<120000)
{
m=id-110000;
cout<<"student_name:"<<std[m].student_name<<endl;
cout<<"class_name:"<<std[m].class_name<<endl;
cout<<"parent_name:"<<std[m].parent_name<<endl;
std[m].student_fees_pay(m);
}

cout<<endl<<"enter [0] to go back:";
cin>>m;
if(m==0)
goto x;

case 5:

cout<<"enter id:";
cin>>id;
if(id>110000&&id<120000)
{
m=id-110000;
cout<<"student_name:"<<std[m].student_name<<endl;
cout<<"class_name:"<<std[m].class_name<<endl;
cout<<"parent_name:"<<std[m].parent_name<<endl;
std[m].student_fees_status(m);

cout<<endl<<"enter [0] to go back:";
cin>>m;
if(m==0)
goto x;
case -1:

cout<<"enter std_id:";
cin>>id;
if(id>110000&&id<120000)
{
m=id-110000;
std[m].student_delete();
std[m].student_fees_delete(m);
cout<<"student std_id:"<<m+110000<<" is deleted"<<endl;
cout<<"std_id:"<<m+110000<<" is now available for another student"<<endl;
cout<<"student availabel seat is updated:"<<endl;

std[m].student_display();
std[m].student_fees_status(i);
}
cout<<endl<<"enter [0] to go back:";
cin>>m;
if(m==0)
goto x;


case -2:

cout<<"enter number of seats to see availability:";
cin>>m;
student_available_seat(m);

cout<<endl<<"enter [0] to go back:";
cin>>m;
if(m==0)
goto x;

case -3:

cout<<"enter std_id:";
cin>>id;
m=id-110000;
student_admit_particular_id(m);
cout<<endl<<"enter [0] to go back:";
cin>>m;
if(m==0)
goto x;

case -4:

for(m=1;m<400;m++)
std[m].student_upgrade(m);
cout<<endl<<"enter [0] to go back:";
cin>>m;
if(m==0)
goto x;

}
}
getch();
}


A presentation on clipping Technique in C graphics


#include <stdio.h>
#include<conio.h>
#include<iostream.h>
#include <stdlib.h>
#include <graphics.h>
#include<dos.h>
#define MAX 20
typedef struct
{
float x;
float y;
}PT;
int m;//global variable for polygon clipping
/*prototype for sutherland polygon clipping functions*/
void polygon_clipping();
void polygon_info();
void top(PT p1,PT p[20],PT pp[20]);
void bottom (PT p2,PT p[20],PT pp[20]);
void left(PT p1,PT p[20],PT pp[20]);
void right(PT p2,PT p[20],PT pp[20]);
void drawpolygon(PT x[20],int n);


//*prototype of cohensutherland line clipping*/
void line_clipping();
void line_clipping_info();
void cohen_sutherland (double x1, double y1, double x2, double y2,
double xmin, double ymin, double xmax, double ymax);
/*cohen suther land line clipping*/
enum { TOP = 0x1, BOTTOM = 0x2, RIGHT = 0x4, LEFT = 0x8 };

enum { FALSE, TRUE };
typedef unsigned int outcode;

outcode compute_outcode(int x, int y,
int xmin, int ymin, int xmax, int ymax)
{
    outcode oc = 0;

    if (y > ymax)
oc |= TOP;
    else if (y < ymin)
oc |= BOTTOM;


    if (x > xmax)
oc |= RIGHT;
    else if (x < xmin)
oc |= LEFT;

    return oc;
}
/*prototype for Weiler-Atherton Polygon Clipping*/
void weiler_polygon_clipping();

void main()
{
int ch;

    int gd = DETECT, gm;

initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
clrscr();
setbkcolor(2);
settextstyle(SMALL_FONT,HORIZ_DIR,6);
outtextxy(100,60,"A PRESENTATION ON CLIPPING TECHNIQUE ");
outtextxy(100,90,"Submitted by Saurabh And Shubham ");

outtextxy(50,130,"Name:Saurabh gupta ");
outtextxy(50,170,"Registration no.:11009096");
outtextxy(50,210,"Rollno:K1003A19");

outtextxy(350,130,"Name:Shubham varshney");
outtextxy(350,170,"Registration no.:11011481");
outtextxy(350,210,"Rollno:K1003A24");

outtextxy(50,350,"submitted to Mr.Gaurav Raj");
outtextxy(50,390,"DEPARTMENT OF COMPUTER SCIENCE");




outtextxy(50,250,"press 1 to start presentation");
settextstyle(SMALL_FONT,HORIZ_DIR,4);
int x;
cin>>x;
if(x==1)
{
label0:
cleardevice();
setbkcolor(3);
settextstyle(SMALL_FONT,HORIZ_DIR,6);
outtextxy(50,30,"[1] cohen suderland line clipping");
outtextxy(50,50,"[2] suderland-hodgeman polygon clipping");
outtextxy(50,70,"[3] wieler-artheton");
outtextxy(50,90,"Enter your choice:");
outtextxy(50,110,"Enter 0 to exit");
settextstyle(SMALL_FONT,HORIZ_DIR,4);
cin>>ch;
clrscr();
switch(ch)
{

case 1:
label1:
cleardevice();
setbkcolor(4);                        //set background colour
line_clipping_info();               //function of line clipping
line_clipping();
outtextxy(50,50,"press 0 to go back to main menu");
outtextxy(50,60,"press 2 to see polygon clipping");
outtextxy(50,70,"press 3 to see  weiler-Atherton Polygon Clipping");
cin>>x;
if(x==0)
goto label0;
if(x==2)
goto label2;
if(x==3)
goto label3;
// break;

case 2:
label2:
cleardevice();
setbkcolor(5);
polygon_info();
outtextxy(50,350,"press 1 to see the example of polygon clipping");
cin>>x;
if(x==1)
polygon_clipping();
outtextxy(50,60,"press 0 to go back to main menu");
outtextxy(50,70,"press 1 to see line clipping");
outtextxy(50,80,"press 3 to see  weiler-Atherton Polygon Clipping");
cin>>x;
if(x==0)
goto label0;
if(x==1)
goto label1;
if(x==3)
goto label3;

//break;


case 3:
label3:
cleardevice();
setbkcolor(6);
weiler_polygon_clipping();
outtextxy(50,360,"press 0 to go back to main menu");
outtextxy(50,370,"press 1 to see line clipping");
outtextxy(50,380,"press 2 to see polygon clipping");
cin>>x;
if(x==0)
goto label0;
if(x==1)
goto label1;
if(x==2)
goto label2;
}
}

else
{
cleardevice();
outtextxy(100,100,"wrong choice pressed");
}
cleardevice();
setbkcolor(2);
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 5);
outtextxy(150,150,"THANK YOU");

getch();
closegraph();

}







void cohen_sutherland (double x1, double y1, double x2, double y2,
double xmin, double ymin, double xmax, double ymax)
{
    int accept;
    int done;
    outcode outcode1, outcode2;

    accept = FALSE;
    done = FALSE;

    outcode1 = compute_outcode (x1, y1, xmin, ymin, xmax, ymax);
    outcode2 = compute_outcode (x2, y2, xmin, ymin, xmax, ymax);
    do
    {
if (outcode1 == 0 && outcode2 == 0)
{
   accept = TRUE;
   done = TRUE;
}
else if (outcode1 & outcode2)
{
   done = TRUE;
}
else
{
   double x, y;
   int outcode_ex = outcode1 ? outcode1 : outcode2;
   if (outcode_ex & TOP)
   {
x = x1 + (x2 - x1) * (ymax - y1) / (y2 - y1);
y = ymax;
   }

   else if (outcode_ex & BOTTOM)
   {
x = x1 + (x2 - x1) * (ymin - y1) / (y2 - y1);
y = ymin;
   }
   else if (outcode_ex & RIGHT)
   {
y = y1 + (y2 - y1) * (xmax - x1) / (x2 - x1);
x = xmax;
   }
   else
   {
y = y1 + (y2 - y1) * (xmin - x1) / (x2 - x1);
x = xmin;
   }
   if (outcode_ex == outcode1)
   {
x1 = x;
y1 = y;
outcode1 = compute_outcode (x1, y1, xmin, ymin, xmax, ymax);
   }
   else
   {
x2 = x;
y2 = y;
outcode2 = compute_outcode (x2, y2, xmin, ymin, xmax, ymax);
   }
}
    } while (done == FALSE);

    if (accept == TRUE)
line (x1, y1, x2, y2);
}


void left(PT p1,PT p[20],PT pp[20])
{
int  i,j=0;
for(i=0;i<m;i++)
{
if(p[i].x < p1.x && p[i+1].x >= p1.x){
if(p[i+1].x-p[i].x!=0)
{
pp[j].y = (p[i+1].y-p[i].y)/(p[i+1].x-p[i].x)* (p1.x-p[i].x)+p[i].y;
}
else
{
pp[j].y = p[i].y;
}
pp[j].x = p1.x;
j++;
pp[j].x=p[i+1].x;
pp[j].y=p[i+1].y;
j++;
}
if(p[i].x > p1.x && p[i+1].x >= p1.x)
{
pp[j].y = p[i+1].y;
pp[j].x = p[i+1].x;
j++;
}
if(p[i].x > p1.x && p[i+1].x <= p1.x)
{
if(p[i+1].x-p[i].x!=0)
{
pp[j].y = (p[i+1].y-p[i].y)/(p[i+1].x-p[i].x)* (p1.x-p[i].x)+p[i].y;
}
else
{
pp[j].y = p[i].y;
}
pp[j].x = p1.x;
j++;
}
}
for(i=0;i<j;i++)
{
p[i].x = pp[i].x;
p[i].y = pp[i].y;
}
p[i].x = pp[0].x;
p[i].y = pp[0].y;
m=j;
}
void right(PT p2,PT p[20],PT pp[20])
{
int i,j=0;
for(i=0;i<m;i++)
{if(p[i].x > p2.x && p[i+1].x <= p2.x)
{
if(p[i+1].x-p[i].x!=0)
{
pp[j].y = (p[i+1].y-p[i].y)/(p[i+1].x-p[i].x)* (p2.x-p[i].x)+p[i].y;
}
else
{
pp[j].y = p[i].y;
}
pp[j].x = p2.x;
j++;
pp[j].x=p[i+1].x;
pp[j].y=p[i+1].y;
j++;
}
if(p[i].x < p2.x && p[i+1].x <= p2.x)
{
pp[j].y = p[i+1].y;
pp[j].x = p[i+1].x;
j++;
}
if(p[i].x < p2.x && p[i+1].x >= p2.x)
{
if(p[i+1].x-p[i].x!=0)
{
pp[j].y = (p[i+1].y-p[i].y)/(p[i+1].x-p[i].x)* (p2.x-p[i].x)+p[i].y;
}
else
{
pp[j].y = p[i].y;
}
pp[j].x = p2.x;
j++;
}
}
for(i=0;i<j;i++)
{
p[i].x = pp[i].x;
p[i].y = pp[i].y;
}
p[i].x = pp[0].x;
p[i].y = pp[0].y;
m=j;
}
void top(PT p1,PT p[20],PT pp[20])
{
int  i,j=0;
for(i=0;i<m;i++){
if(p[i].y < p1.y && p[i+1].y >= p1.y)
{
if(p[i+1].y-p[i].y!=0)
{
pp[j].x = (p[i+1].x-p[i].x)/(p[i+1].y-p[i].y)* (p1.y-p[i].y)+p[i].x;
}
else
{
pp[j].x = p[i].x;
}
pp[j].y = p1.y;
j++;
pp[j].x=p[i+1].x;
pp[j].y=p[i+1].y;
j++;
}
if(p[i].y > p1.y && p[i+1].y >= p1.y)
{
pp[j].y = p[i+1].y;
pp[j].x = p[i+1].x;
j++;
}
if(p[i].y > p1.y && p[i+1].y <= p1.y)
{
if(p[i+1].y-p[i].y!=0)
{
pp[j].x = (p[i+1].x-p[i].x)/(p[i+1].y-p[i].y)* (p1.y-p[i].y)+p[i].x;
}
else
{
pp[j].x = p[i].x;
}
pp[j].y = p1.y;
j++;
}
}
for(i=0;i<j;i++)
{
p[i].x = pp[i].x;
p[i].y = pp[i].y;
}
p[i].x = pp[0].x;
p[i].y = pp[0].y;
m=j;
}
void bottom(PT p2,PT p[20],PT pp[20])
{
int i,j=0;for(i=0;i<m;i++)
{
if(p[i].y > p2.y && p[i+1].y <= p2.y)
{
if(p[i+1].y-p[i].y!=0)
{
pp[j].x = (p[i+1].x-p[i].x)/(p[i+1].y-p[i].y)* (p2.y-p[i].y)+p[i].x;
}
else
{
pp[j].x = p[i].x;
}
pp[j].y = p2.y;
j++;
pp[j].x=p[i+1].x;
pp[j].y=p[i+1].y;
j++;
}
if(p[i].y < p2.y && p[i+1].y <= p2.y)
{
pp[j].y = p[i+1].y;
pp[j].x = p[i+1].x;
j++;
}
if(p[i].y < p2.y && p[i+1].y >= p2.y)
{
if(p[i+1].y-p[i].y!=0)
{
pp[j].x = (p[i+1].x-p[i].x)/(p[i+1].y-p[i].y)* (p2.y-p[i].y)+p[i].x;
}
else
{
pp[j].x = p[i].x;
}
pp[j].y = p2.y;
j++;
}
}
for(i=0;i<j;i++)
{
p[i].x = pp[i].x;
p[i].y = pp[i].y;
}
p[i].x = pp[0].x;
p[i].y = pp[0].y;
m=j;
}
void drawpolygon(PT x[20],int m)
{
int i;
for(i=0;i<m-1;i++)
{
line(x[i].x,x[i].y,x[i+1].x,x[i+1].y);
}
line(x[i].x,x[i].y,x[0].x,x[0].y);
}




void line_clipping()
{
    int n=3;
    int i, j;
    int ln[MAX][4];
    int clip[4];


      outtextxy(370,300,"press enter to see demonstration");
      ln[0][0]=30+300;
      ln[0][1]=70+300;
      ln[0][2]=60+300;
      ln[0][3]=70+300;

      ln[1][0]=30+300;
      ln[1][1]=90+300;
      ln[1][2]=60+300;
      ln[1][3]=30+300;

      ln[2][0]=50+300;
      ln[2][1]=100+300;
      ln[2][2]=90+300;
      ln[2][3]=60+300;


    /*for (i=0; i<n; i++)
for (j=0; j<4; j++)
   scanf ("%d", &ln[i][j]);

    printf ("Enter the x- and y-coordinates of the left-top and right-");
    printf ("bottom corners\nof the clip window:\n");

    for (i=0; i<4; i++)
scanf ("%d", &clip[i]); */
clip[0]=40+300;
clip[1]=50+300;


clip[2]=80+300;
clip[3]=90+300;

       // cleardevice();
rectangle (clip[0], clip[1], clip[2], clip[3]);
for (i=0; i<n; i++)
line (ln[i][0], ln[i][1], ln[i][2], ln[i][3]);
getch();
   cleardevice();
    rectangle (clip[0], clip[1], clip[2], clip[3]);
    for (i=0; i<n; i++)
    {
cohen_sutherland (ln[i][0], ln[i][1], ln[i][2], ln[i][3],
   clip[0], clip[1], clip[2], clip[3]);
getch();
    }
    getch();
  //  closegraph();
    }

void polygon_clipping()
{
PT d,p1,p2,p[20],pi1,pi2,pp[20];
m=8;
p1.x=100;
p1.y=100;
p2.x=200;
p2.y=200;



p[0].x=150;
p[0].y=80;

p[1].x=170;
p[1].y=130;

p[2].x=220;
p[2].y=150;

p[3].x=170;
p[3].y=170;

p[4].x=150;
p[4].y=220;

p[5].x=130;
p[5].y=170;

p[6].x=80;
p[6].y=150;

p[7].x=130;
p[7].y=130;



p[8].x = p[0].x;
p[8].y = p[0].y;
cleardevice();
outtextxy(50,30,"before clipping the window is like this");
drawpolygon(p,m);
rectangle(p1.x,p1.y,p2.x,p2.y);
getch();
left(p1,p,pp);
right(p2,p,pp);
top(p1,p,pp);
bottom(p2,p,pp);
cleardevice();
outtextxy(50,30,"after clipping window is clipped like this");
rectangle(p1.x,p1.y,p2.x,p2.y);
drawpolygon(p,m);
getch();
//closegraph();
}



void line_clipping_info()
{
cleardevice();
setbkcolor(4);

outtextxy(50,30,"Cohen-Sutherland Line Clipping");
outtextxy(250,30,".......");
delay(1000);
outtextxy(50,60,"This is one of the oldest and most popular line-clipping procedure.");
outtextxy(50,70,"Generally,the method speed up the processing of the line segments by");
outtextxy(50,80,"performing initial tests that reduce the number of intersections that");
outtextxy(50,90,"must be calculated.Every line end point in a picture is assigned");
outtextxy(50,100,"a four-digit binary code,called a region,that identifies the location");
outtextxy(50,110,"of the point realtive to the boundaries as shown in fig.");
outtextxy(50,140,"bit 1: Left");
outtextxy(50,150,"bit 2: Right");
outtextxy(50,160,"bit 3: Below");
outtextxy(50,170,"bit 4: Above");

rectangle(50,190,200,300);
delay(1000);
line(100,190,100,300);
delay(1000);
line(150,190,150,300);
delay(1000);
line(50,230,200,230);
delay(1000);
line(50,265,200,265);

outtextxy(60,200,"1001");
delay(1000);
outtextxy(110,200,"1000");
delay(1000);
outtextxy(160,200,"1010");
delay(1000);

outtextxy(60,240,"0001");
delay(1000);
outtextxy(110,240,"0000");
delay(1000);
outtextxy(160,240,"0010");
delay(1000);
outtextxy(60,275,"0101");
delay(1000);
outtextxy(110,275,"0100");
delay(1000);
outtextxy(160,275,"0110");
delay(1000);
outtextxy(101,250,"window");
delay(1000);

outtextxy(300,300,"Example:");
delay(1000);
}

void polygon_info()
{
cleardevice();
outtextxy(50,30,"Sytherland-Hodgeman Polygon Clipping");
outtextxy(250,30,".........");
delay(1000);
outtextxy(50,60,"There are possible four cases when procesing vertices in sequence");
outtextxy(50,70,"around the perimeter of a polygon.As each pair of adjacent polygon");
outtextxy(50,80,"vertices are passed to a window boundary clipper,we make the following");
outtextxy(50,90,"[1] if the first vertext is outside the window boundary and the second ");
outtextxy(50,100,"   vertex is inside, both the intersection point of the polygon edge");
outtextxy(50,110,"   with the window boundary and second vertex is added to the output");
outtextxy(50,120,"[2] if both input vertices are inside the window boundary.");
outtextxy(50,130,"    only the second vertex is added to the output vertex list");
outtextxy(50,140,"[3] if the first vetex is inside the window boundary and the second");
outtextxy(50,150,"    vertex is outside only the edge intersection with the window boundary is");
outtextxy(50,160,"    added to the output list");
outtextxy(50,170,"[4] if both input vertices are outside the window boundary, nothing is");
outtextxy(50,180,"    addded to the output list.");
delay(500);
rectangle(50,200,100,300);
delay(1250);
line(30,250,80,250);
delay(1100);
outtextxy(20,257,"v1");
outtextxy(85,257,"v2");
outtextxy(50,253,"v1'");
outtextxy(50,310,"out-in");
outtextxy(50,320,"save v1',v2");

rectangle(150,200,200,300);
delay(1250);
line(170,220,180,280);
delay(1100);
outtextxy(175,220,"v1");
outtextxy(160,280,"v2");
outtextxy(150,310,"in-in");
outtextxy(150,320,"save v2");

rectangle(250,200,300,300);
delay(1250);
line(230,280,280,250);
delay(1100);
outtextxy(230,280,"v2");
outtextxy(280,250,"v1");
outtextxy(240,260,"v1'");
outtextxy(250,310,"in-out");
outtextxy(250,320,"save v1'");

rectangle(350,200,400,300);
delay(1250);
line(330,210,330,280);
delay(1100);
outtextxy(320,210,"v1");
outtextxy(320,280,"v2");
outtextxy(350,310,"out-out");
outtextxy(350,320,"save none");
}
void weiler_polygon_clipping()
{
outtextxy(50,30,"Weiler-Atherton Polygon Clipping");
outtextxy(50,60,"In this clipping method vertex processing procedures");
outtextxy(50,70,"for window boundaries are modified so that concave polygons");
outtextxy(50,80,"are displayed correctly.The basic idea int this algorithm");

outtextxy(50,90,"is that instead of always proceeding around the polygon edges");
outtextxy(50,100,"as vertices are processed,we sometimes want to follow the window");
outtextxy(50,110,"boundaries.Which path follow depends on the polygon-processing");
outtextxy(50,120,"direction (clockwise or counter clockwise) and whether the pair");
outtextxy(50,130,"of polygon vertices currently being processed represents an");
outtextxy(50,140,"outside-to-inside or an inside-to-outside pair.");
outtextxy(50,170,"For clockwise direction processing of polygon vertices, we use");
outtextxy(50,180,"following rules.");
outtextxy(50,190,"[1] For an outside-to-inside pair of vertices,follow the polygon");
outtextxy(50,200,"    boundary.");
outtextxy(50,210,"[2] For an inside-to-outside pair of vertices,follow the window");
outtextxy(50,220,"    boundary in a clockwise direction.");
rectangle(70,240,180,360);
delay(1100);
line(30,310,110,270);
delay(1100);
line(110,270,100,295);
delay(1100);
line(100,295,50,330);
delay(1100);
line(50,330,110,340);
delay(1100);
line(110,340,30,350);
delay(1100);
line(30,310,30,350);
delay(1100);
outtextxy(20,310,"v1");
delay(1100);
outtextxy(110,270,"v2");
delay(1100);
outtextxy(105,295,"v3");
delay(1100);
outtextxy(45,330,"v4");
delay(1100);
outtextxy(115,340,"v5");
delay(1100);
outtextxy(20,350,"v6");
delay(1100);
outtextxy(65,285,"v1'");
delay(1100);
outtextxy(65,305,"v3'");
 delay(1100);
outtextxy(75,325,"v4'");
delay(1100);
outtextxy(50,350,"v5'");

outtextxy(50,250,"press 1 to start presentation");
 cleardevice();
rectangle(70,240,180,360);
setcolor(11);
line(70,290,110,270);
line(110,270,100,295);
line(100,295,70,320);
line(70,290,70,320);
delay(2000);
line(70,330,110,340);
line(70,330,110,340);
line(110,340,70,350);
line(70,330,70,350);
setcolor(15);



}