Tuesday, October 27, 2015

IMPORTANT DAYS


IMPORTANT DAYS IN JANUARY

Jan 1 Army Medical Corps Establishment Day

Jan 8 African National Congress Foundation Day

Jan 9 Pravasi Bharatiya Divas

Jan 10 World Laughter Day

Jan 11 Death anniversary of Lal Bahadur Shastri

Jan 12 National youth Day (Birth Day of Swami Vivekananda)

Jan 15 Army Day

Jan 23 Netaji Subhash Chandra Bose's birth anniversary

Jan 25 International Customs Duty Day, India Tourism Day, Indian Voter Day

Jan 26 Republic Day

Jan 28 Birth anniversary of Lala Lajpat Rai

Jan 30 (Martyr's day) Mahatma Gandhi's Martyrdom Day;World Leprosy Eradication Day

Jan 31 World Leprosy Eradication Day

IMPORTANT DAYS IN FEBRUARY

Feb 2 World Wetlands Day

Feb 4 National Day of Srilanka

Feb 5 Kashmir Day (Organised by Pakistan)

Feb 13 Sarojini Naidu's Birth Anniversary

Feb 14 St. Valentine's Day

Feb 24 Central Exise Day

Feb 28 National Science Day

IMPORTANT DAYS IN MARCH

Mar 3 National Defence Day

Mar 4 National Security Day

Mar 8 International Women's Day

Mar 9 CISF Raising Day

Mar 12 Mauritius Day;Central Industrial Security Force Day

Mar 15 World Consumer Day

Mar 16 National Vaccination Day

Mar 21 World Forestry Day

Mar 22 World Day of Water

Mar 23 World Meterological Day

Mar 24 World TB Day

Mar 26 Bangaladesh Liberation Day

IMPORTANT DAYS IN APRIL

April 1 Orissa Day

April 5 Natinal Meritime Day

April 7 World Health Day

April 13 Jallianwallah Bagh Massacre Day (1919)

April 14 B.R. Ambedkar Remembrance Day

April 18 World Heritage Day

April 22 World Earth Day

April 23 World Books Day

IMPORTANT DAYS IN MAY

May 1 International Labour Day, Maharashtra Day

May 3 International Energy Day

May 8 International Red Cross Day (It is celebrated to commemorate the birth anniversary of the founder of the Red Cross Organization Jean Henry Dunant)

May 11 National Technology Day

May 15 International Family Day

May 17 World Telecom Day

May 24 Commonwealth Day

May 31 World No Tobacco Day

IMPORTANT DAYS IN JUNE

June 5 World Environment Day

June 8 World Oceans day

June 12 World Day Against Child Labour

June 14 World Blood Donor day

June 15 World Elder Abuse Awareness Day

June 17 World Day to Combat Desertification

June 20 World Refugee Day

June 21 International Yoga Day

June 23 United Nations Public Service Day

June 26 International Day Against Drug Abuse and Illicit Trafficking

June 29 Statistics Day

IMPORTANT DAYS IN JULY

July 1 Doctor's Day American Independance Day

July 4 American Independance Day

July 11 World Population Day

July 18 Mandela Day

July 26 Kargil Victory Day

July 28 World Hepatitis Day

IMPORTANT DAYS IN AUGUST

Aug 6 Hiroshima Day

Aug 9 Quit India Movement Day

Aug 12 International youth Day

Aug 14 Pakistan's Independence Day

Aug 15 India's Independence Day

Aug 19 World Photography Day

Aug 20 Sadbhavana Diwas

Aug 29 National Sports Day of India (Dhyanchand's Birth Day)

Aug 30 Small Industry Day

IMPORTANT DAYS IN SEPTEMBER

Sept 5 Teacher's Day (Dr. Radhakrishnan's Birth Day)

Sept 7 Forgiveness Day

Sept 8 International Literacy Day

Sept 14 Hindi day,World First Aid Day

Sept 16 World Ozone Day

Sept 21 International Day of Peace, World Alzheimer's day

Sept 25 Social Justice Day

Sept 27 World Tourism Day

IMPORTANT DAYS IN OCTOBER

Oct 1 International Day for the Elderly(UN)

Oct 2 Gandhi Jayanti, International Day of Non-Violence

Oct 3 World Nature Day, World Habitat Day

Oct 4 World Animal Day

Oct 5 World Teacher's Day

Oct 6 World Wildlife Day, World Food Security Day

Oct 8 Indian Airforce day

Oct 9 World Postal Day

Oct 10 World Mental Health day;National Post Day

Oct 11 International Girl Child Day

Oct 12 World Sight day

Oct 13 World Calamty Control Day(UN)

Oct 14 World Standard Day

Oct 15 World White cane day(guiding the blind)

Oct 16 World Food Day

Oct 17 International poverty

Oct 20 National Solidarity Day (China attacked India on that day)

Oct 24 United Nations Day

Oct 30 World Thrift Day

Oct 31 Rastriya Ekta Diwas (Sardar Patel), National Integration Day (In memory of Indira Gandhi)

IMPORTANT DAYS IN NOVEMBER

Nov 7 Infant Protection day;World Cancer Awareness Day

Nov 9 Legal Service Day

Nov 10 Transport Day

Nov 14 Children's day/ World Diabetic's day

Nov 17 Guru Nanak Dev's Birth Anniverrsary

Nov 26 Law Day

Nov 30 Flag Day

IMPORTANT DAYS IN DECEMBER

Dec1 World AIDS Day

Dec 3 World Disability Day

Dec 4 Navy Day

Dec 7 Armed Force Flag Day

Dec 10 Human Rights day

Dec 11 UNICEF Day

Dec 14 National Energy Conservation Day

Dec 19 Goa's Liberation day

Dec 23 Kisan Divas (Farmer's Day)



Thursday, June 18, 2015

Hey Folks,
How are you all? Happily coding??:-) Its been a few months that I could not get engaged in my Blog. Well, I am back....... :D

Lets learn some very interesting Web Development Technologies.... BOOTSTRAP, HTML 5, CSS3 and ANGULAR JS....

So keep visiting my blog....See you soon..... :)


Saturday, March 15, 2014

QUESTION PAPERS


SEVENTH SEMESTER BTECH IT NOVEMBER 2013

SOFTWARE PROJECT MANAGEMENT


                                                              INTERNET WORKING


CRYPTOGRAPHY


                                                        SIMULATION AND MODELING




Friday, June 21, 2013

Tennis game using graphics in C

//tennis game by fensa
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
void main()
{
 float x=1,y=0.0,j=0.5,count=0.1,i,k,r=10;
 int gd=DETECT,gm;
 initgraph(&gd,&gm,"c:\\tc\\bgi");
 circle(20,230,20);//bat1
 line(20,250,20,300);
 circle(450,230,20);//bat2
 line(450,250,450,300);
// line(0,400,650,400);

 sleep(1);
 for(k=0;k<1;k++)
 {
  for(i=90;i<=270;i=i+2)
  {
   y=cos((i*22/7)/180)/j;
   if(y>0)
    y=-y;
    x=x+5;
    setcolor(14);
    setfillstyle(1,14);
    circle(x,y*75+200,r);
    floodfill(x,y*75+200,14);
    delay(40);
   setcolor(0);
   setfillstyle(1,0);
   circle(x,y*75+200,r);
   floodfill(x,y*75+200,0);
  }
   j=j+count;
   count=count+0.1;
 }
 for(k=0;k<1;k++)
 {
  for(i=270;i>=90;i=i-2)
  {
   y=cos((i*22/7)/180)/j;
   if(y>0)
    y=-y;
    x=x-5;
    setcolor(14);
    setfillstyle(1,14);
    circle(x,y*75+200,r);
    floodfill(x,y*75+200,14);
    delay(40);
   setcolor(0);
   setfillstyle(1,0);
   circle(x,y*75+200,r);
   floodfill(x,y*75+200,0);
  }
   j=j+count;
   count=count+0.1;
 }
 for(k=0;k<1;k++)
 {
  for(i=90;i<=270;i=i+2)
  {
   y=cos((i*22/7)/180)/j;
   if(y>0)
    y=-y;
    x=x+5;
    setcolor(14);
    setfillstyle(1,14);
    circle(x,y*75+200,r);
    floodfill(x,y*75+200,14);
    delay(40);
   setcolor(0);
   setfillstyle(1,0);
   circle(x,y*75+200,r);
   floodfill(x,y*75+200,0);
  }
   j=j+count;
   count=count+0.1;
 }
 getch();
 closegraph();
}

ball hitting wicket using graphics in C

//cricket by fensa
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
void main()
{
 float x=1,y=0.0,j=0.5,count=0.1,i,k,r=10;
 int gd=DETECT,gm;
 initgraph(&gd,&gm,"c:\\tc\\bgi");
 line(0,210,650,210);
 line(470,150,470,210);//stump
 line(490,150,490,210);
 line(510,150,510,210);
 line(471,149,489,149);//wicket
 line(491,149,509,149);

 sleep(1);

 for(k=0;k<3;k++)
 {
  for(i=90;i<=250;i=i+5)
  {
    y=cos((i*22/7)/180)/j;
    if(y>0)
    y=-y;
    x=x+5;
    setcolor(14);
    setfillstyle(1,14);
    circle(x,y*100+200,r);
    floodfill(x,y*100+200,14);
    delay(40);
    setcolor(0);
    setfillstyle(1,0);
    circle(x,y*100+200,r);
    floodfill(x,y*100+200,0);
  }
    j=j+count;
    count=count+0.1;
 }
 cleardevice();
 setcolor(15);
 line(0,210,650,210);
 line(450,150,470,210);//stump
 line(490,150,490,210);
 line(530,150,510,210);
 line(471,149,489,139);//wicket
 line(493,139,512,149);
 getch();
}

Thursday, May 2, 2013

simple traffic system


//traffic system
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int i;
 int gd=DETECT,gm;
 initgraph(&gd,&gm,"c:\\tc\\bgi");

 for(i=0;i<600;i++)
 {
  outtextxy(30,50,"traffic system by Fensa Saj");
  rectangle(50+i,300,100+i,400);

  //traffic post
 line(10,200,600,200);
 line(500,180,500,200);
 rectangle(475,80,525,180);
 circle(500,100,10);
 circle(500,130,10);
 circle(500,160,10);
 setfillstyle(1,2);
 floodfill(500,160,15);
 if(i==350)
 {
 setfillstyle(1,0);
 floodfill(500,160,15);
 setfillstyle(1,14);
 floodfill(500,130,15);
 delay(600);
 setfillstyle(1,0);
 floodfill(500,130,15);
 setfillstyle(1,4);
 floodfill(500,100,15);
 delay(3000);
 }
 setfillstyle(1,2);
 floodfill(500,160,15);
 delay(40);
 cleardevice();
 }
 getch();
}

Monday, April 22, 2013

Analog clock using graphics in c


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>
#define arg_sec M_PI/30
#define arg_hour M_PI/6
#define arg_min M_PI/360
void main()
{
  int a,b,i;
  int gd=DETECT,gm,sec=0,hour,min,x1=0,y1=0,x2=0,y2=0,x3=0,y3=0;
  char *k[12]={"1","2","3","4","5","6","7","8","9","10","11","12"};
  struct time t;
  initgraph(&gd,&gm,"c:\\tc\\bgi");
  setcolor(YELLOW);
  circle(300,200,200);
  circle(300,200,180);
  setfillstyle(1,RED);
  floodfill(300,390,YELLOW);
  settextstyle(DEFAULT_FONT,0,2);

  for(i=1;i<13;i++)
    {
a=160*cos(arg_hour*i-M_PI_2);
b=160*sin(arg_hour*i-M_PI_2);
outtextxy(a+300,b+200,k[i-1]);
    }

  while(!kbhit())
   {
      settextstyle(7,0,1);
      outtextxy(278,280,"Quartz");
      setcolor(BLACK);
      line(300,200,x1+300,y1+200);
      line(300,200,x2+300,y2+200);
      line(300,200,x3+300,y3+200);
      gettime(&t);
      if(sec!=t.ti_sec)
{
  sound(5000);
  delay(1);
  nosound();
}
      hour=t.ti_hour;
      sec=t.ti_sec;
      min=t.ti_min;

      x1=150*cos(arg_sec*sec-M_PI_2)*0.98;
      y1=150*sin(arg_sec*sec-M_PI_2)*0.98;
      x2=150*cos(arg_sec*min-M_PI_2)*0.9;
      y2=150*sin(arg_sec*min-M_PI_2)*0.9;
      if(hour>12) hour-=12;
      x3=150*cos(arg_hour*hour-M_PI_2+arg_min*min)*0.6;
      y3=150*sin(arg_hour*hour-M_PI_2+arg_min*min)*0.6;
      setcolor(YELLOW);
      line(300,200,x1+300,y1+200);
      setcolor(CYAN);
      line(300,200,x2+300,y2+200);
      setcolor(WHITE);
      line(300,200,x3+300,y3+200);
      setcolor(YELLOW);
      delay(50);
   }

  getch();
  closegraph();
}

Digital clock using graphics in c


//digital_clock

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>

void main()
{
   int gd = DETECT, gm;
   int i=0, a[5];
   struct time t;
   initgraph(&gd, &gm, "c:\\tc\\bgi"); //Initializing Graphics mode
 
   while(!kbhit()) // if key hit is not received, display the clock
   {
    setcolor(YELLOW);
    gettime(&t);
    if(t.ti_hour>12)
    {
     t.ti_hour = t.ti_hour-12;
     settextstyle(DEFAULT_FONT,0,4);
     outtextxy(550,150,"PM");
    }
    else
    {
     outtextxy(550,150,"AM");
    }
    a[0]=t.ti_hour/10;
    a[1]=t.ti_hour%10;
    a[2]=t.ti_min/10;
    a[3]=t.ti_min%10;
    a[4]=t.ti_sec/10;
    a[5]=t.ti_sec%10;
    circle(240,150,2);
    circle(240,160,2);
    circle(390,150,2);
    circle(390,160,2);
    for(i=0;i<6;i++)
    {
     switch(a[i]) //Out the particular digit according to the input//
     {
      case 0:
    {
line(105+i*75,100,145+i*75,100);
line(100+i*75,105,100+i*75,145);
line(100+i*75,155,100+i*75,195);
line(105+i*75,200,145+i*75,200);
line(150+i*75,155,150+i*75,195);
line(150+i*75,105,150+i*75,145);
break;
    }
      case 1:
      {
       line(150+i*75,155,150+i*75,195);
       line(150+i*75,105,150+i*75,145);
       break;
      }
      case 2:
      {
       line(105+i*75,100,145+i*75,100);
       line(100+i*75,155,100+i*75,195);
       line(105+i*75,200,145+i*75,200);
       line(150+i*75,105,150+i*75,145);
       line(105+i*75,150,145+i*75,150);
       break;
      }
      case 3:
      {
       line(105+i*75,100,145+i*75,100);
       line(105+i*75,200,145+i*75,200);
       line(150+i*75,155,150+i*75,195);
       line(150+i*75,105,150+i*75,145);
       line(105+i*75,150,145+i*75,150);
       break;
      }
      case 4:
      {
       line(100+i*75,105,100+i*75,145);
       line(150+i*75,155,150+i*75,195);
       line(150+i*75,105,150+i*75,145);
       line(105+i*75,150,145+i*75,150);
       break;
      }
    case 5:
    {
    line(105+i*75,100,145+i*75,100);
    line(100+i*75,105,100+i*75,145);
    line(105+i*75,200,145+i*75,200);
    line(150+i*75,155,150+i*75,195);
    line(105+i*75,150,145+i*75,150);
    break;
    }
    case 6:
    {
    line(105+i*75,100,145+i*75,100);
    line(100+i*75,105,100+i*75,145);
    line(100+i*75,155,100+i*75,195);
    line(105+i*75,200,145+i*75,200);
    line(150+i*75,155,150+i*75,195);
    line(105+i*75,150,145+i*75,150);
    break;
    }
    case 7:
    {
    line(105+i*75,100,145+i*75,100);
    line(150+i*75,155,150+i*75,195);
    line(150+i*75,105,150+i*75,145);
    break;
    }
    case 8:
    {
    line(105+i*75,100,145+i*75,100);
    line(100+i*75,105,100+i*75,145);
    line(100+i*75,155,100+i*75,195);
    line(105+i*75,200,145+i*75,200);
    line(150+i*75,155,150+i*75,195);
    line(150+i*75,105,150+i*75,145);
    line(105+i*75,150,145+i*75,150);
    break;
    }
    case 9:
    {
    line(105+i*75,100,145+i*75,100);
    line(100+i*75,105,100+i*75,145);
    line(105+i*75,200,145+i*75,200);
    line(150+i*75,155,150+i*75,195);
    line(150+i*75,105,150+i*75,145);
    line(105+i*75,150,145+i*75,150);
    break;
    }
    }
    }
   delay(700);
   cleardevice();
   }
   closegraph();
}




Friday, April 5, 2013

Man opening umbrella program using Graphics in C


#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<math.h>
#include<graphics.h>
#include<stdlib.h>
void raindrops();
void far *man1,*man2;
unsigned size1,size2;
int cx=15,cy=360,r=22;
int x=0,y,p,i;
void drawgrass()
   {
    setfillstyle(3,GREEN);
    bar(0,385,getmaxx(),getmaxy());
   }
void drawmanbody()
 {
  fillellipse(15,350,7,7);
  moveto(15,350);
  lineto(15,370);
  lineto(25,360);
  lineto(25,369);
  lineto(15,370);
  lineto(15,390);
  lineto(15,390);
  lineto(15,390);
 }

 void drawman1()
  {
   drawmanbody();
   rectangle(23,369,28,400);
   setfillstyle(SOLID_FILL,RED);
   floodfill(24,370,WHITE);
   size1=imagesize(0,299,30,416);
   man1=malloc(size1);
   getimage(0,299,30,416,man1);
   setfillstyle(SOLID_FILL,WHITE);
   cleardevice();
  }

void drawman2()
 {
  drawmanbody();
  moveto(25,369);
  lineto(25,340);
  line(5,340,41,340);
  arc(23,340,0,180,18);
  setfillstyle(SOLID_FILL,RED);
  floodfill(24,339,WHITE);
  size2=imagesize(0,249,42,416);
  man2=malloc(size2);
  getimage(0,299,42,410,man2);
  cleardevice();
 }

 void raindrops()
   {
    int x,x1,y1;
    setcolor(15);
    x=getmaxx();
    x1=random(x);
    y1=random(480);
    line(x1,y1,x1+5,y1+5);
   }
int path1(int dtn)
{
    int x1,y1;
    setcolor(15);
    if(x>=y)
    {
return 0;
    }
    cleardevice();

    if(dtn==1)
    {

putimage(++i,270,man2,COPY_PUT);
raindrops();
drawgrass();
line(cx+i,cy,cx+x+i,cy+y);
line(cx+i,cy,cx-x+i,cy+y);
    }
    else
    {
putimage(++i,270,man2,COPY_PUT);
raindrops();
drawgrass();
line(cx+i,cy,cx-x+i,cy+y);
line(cx+i,cy,cx+x+i,cy+y);
    }
    delay(50);
    if(kbhit())
exit(0);
    x++;
    if(p<0)
p+=2*x+1;
    else
    {
y--;
p+=2*(x-y)+1;
    }
    x1=x;
    y1=y;
    path1(dtn);

    cleardevice();
    if(dtn==1)
    {
putimage(++i,270,man2,COPY_PUT);
raindrops();
  drawgrass();
line(cx+i,cy,cx+x1+i,cy+y1);
line(cx+i,cy,cx-x1+i,cy+y1);
    }
    else
    {

putimage(++i,270,man2,COPY_PUT);
raindrops();
drawgrass();
line(cx+i,cy,cx-x1+i,cy+y1);
line(cx+i,cy,cx+x1+i,cy+y1);
    }
    delay(50);
    if(kbhit())
exit(0);
    return(0);
}


int path(int dtn)
{
    int x1,y1;
    setcolor(15);
    if(x>=y)
    {
return 0;
    }
 

    if(dtn==1)
    {

putimage(++i,270,man1,COPY_PUT);
  drawgrass();
line(cx+i,cy,cx+x+i,cy+y);
line(cx+i,cy,cx-x+i,cy+y);
    }
    else
    {

putimage(++i,270,man1,COPY_PUT);
  drawgrass();
line(cx+i,cy,cx-x+i,cy+y);
line(cx+i,cy,cx+x+i,cy+y);
    }
    delay(50);
    if(kbhit())
exit(0);
    x++;
    if(p<0)
p+=2*x+1;
    else
    {
y--;
p+=2*(x-y)+1;
    }
    x1=x;
    y1=y;
    path(dtn);

    cleardevice();
    if(dtn==1)
    {

putimage(++i,270,man1,COPY_PUT);
  drawgrass();
line(cx+i,cy,cx+x1+i,cy+y1);
line(cx+i,cy,cx-x1+i,cy+y1);
    }
    else
   {
putimage(++i,270,man1,COPY_PUT);
   drawgrass();
line(cx+i,cy,cx-x1+i,cy+y1);
line(cx+i,cy,cx+x1+i,cy+y1);
    }
    delay(100);
    if(kbhit())
exit(0);
    return(0);
}

 void startwalk()
  {
   double theta;
   for(i=0;i<600;)
    {

if(i<=100)
{
        x=0;
        y=r;
        p=1-r;
path(1);
        x=0;
        y=r;
p=1-r;
path(0);
}
else if(i>100 && i<600)
{
x=0;
y=r;
p=1-r;
path1(1);
x=0;
y=r;
p=1-r;
path1(0);
}
}
}
//umbrella program by Fensa Merry Saj
 void main()
 {
   int i,j;
   int gd=DETECT,gm;
   initgraph(&gd,&gm,"c:\\tc\\bgi");
   drawman1();
   drawman2();
   startwalk();
   raindrops();
   getch();
 }






Sutherland-Hodgeman Polygon Clipping Program in C


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#define round(a) ((int)(a+0.5))
int k;
float xmin,ymin,xmax,ymax,arr[20],m;

void clipl(float x1,float y1,float x2,float y2)
{
if(x2-x1)
m=(y2-y1)/(x2-x1);
if(x1>=xmin && x2>=xmin)
{
arr[k]=x2;
arr[k+1]=y2;
k+=2;
}
if(x1<xmin && x2>=xmin)
{
arr[k]=xmin;
arr[k+1]=y1+m*(xmin-x1);
arr[k+2]=x2;
arr[k+3]=y2;
k+=4;
}
if(x1>=xmin  && x2<xmin)
{
arr[k]=xmin;
arr[k+1]=y1+m*(xmin-x1);
k+=2;
}
}

void clipt(float x1,float y1,float x2,float y2)
{
if(y2-y1)
m=(x2-x1)/(y2-y1);
if(y1<=ymax && y2<=ymax)
{
arr[k]=x2;
arr[k+1]=y2;
k+=2;
}
if(y1>ymax && y2<=ymax)
{
arr[k]=x1+m*(ymax-y1);
arr[k+1]=ymax;
arr[k+2]=x2;
arr[k+3]=y2;
k+=4;
}
if(y1<=ymax  && y2>ymax)
{
arr[k]=x1+m*(ymax-y1);
arr[k+1]=ymax;
k+=2;
}
}

void clipr(float x1,float y1,float x2,float y2)
{
if(x2-x1)
m=(y2-y1)/(x2-x1);
if(x1<=xmax && x2<=xmax)
{
arr[k]=x2;
arr[k+1]=y2;
k+=2;
}
if(x1>xmax && x2<=xmax)
{
arr[k]=xmax;
arr[k+1]=y1+m*(xmax-x1);
arr[k+2]=x2;
arr[k+3]=y2;
k+=4;
}
if(x1<=xmax  && x2>xmax)
{
arr[k]=xmax;
arr[k+1]=y1+m*(xmax-x1);
k+=2;
}
}

void clipb(float x1,float y1,float x2,float y2)
{
if(y2-y1)
m=(x2-x1)/(y2-y1);
if(y1>=ymin && y2>=ymin)
{
arr[k]=x2;
arr[k+1]=y2;
k+=2;
}
if(y1<ymin && y2>=ymin)
{
arr[k]=x1+m*(ymin-y1);
arr[k+1]=ymin;
arr[k+2]=x2;
arr[k+3]=y2;
k+=4;
}
if(y1>=ymin  && y2<ymin)
{
arr[k]=x1+m*(ymin-y1);
arr[k+1]=ymin;
k+=2;
}
}

void main()
{
int gdriver=DETECT,gmode,n,poly[20],i;
float xi,yi,xf,yf,polyy[20];
clrscr();
printf("Coordinates of rectangular clip window :\nxmin,ymin:");
scanf("%f%f",&xmin,&ymin);
printf("Coordinates of rectangular clip window :\nxmax,ymax:");
scanf("%f%f",&xmax,&ymax);
printf("\n\nPolygon to be clipped :\nNumber of sides       :");
scanf("%d",&n);
printf("Enter the coordinates :");
for (i=0;i<2*n;i++)
scanf("%f",&polyy[i]);
polyy[i]=polyy[0];
polyy[i+1]=polyy[1];
for(i=0;i<2*n+2;i++)
poly[i]=round(polyy[i]);
initgraph(&gdriver,&gmode,"C:\\TC\\BGI");
rectangle(xmin,ymax,xmax,ymin);
printf("\tUNCLIPPED POLYGON");
printf("hi");
fillpoly(n,poly);
getch();
cleardevice();
k=0;
for(i=0;i<2*n;i+=2)
clipl(polyy[i],polyy[i+1],polyy[i+2],polyy[i+3]);
n=k/2;
for(i=0;i<k;i++)
polyy[i]=arr[i];
polyy[i]=polyy[0];
polyy[i+1]=polyy[1];
k=0;
for(i=0;i<2*n;i+=2)
clipt(polyy[i],polyy[i+1],polyy[i+2],polyy[i+3]);
n=k/2;
for(i=0;i<k;i++)
polyy[i]=arr[i];
polyy[i]=polyy[0];
polyy[i+1]=polyy[1];
k=0;
for(i=0;i<2*n;i+=2)
clipr(polyy[i],polyy[i+1],polyy[i+2],polyy[i+3]);
n=k/2;
for(i=0;i<k;i++)
polyy[i]=arr[i];
polyy[i]=polyy[0];
polyy[i+1]=polyy[1];
k=0;
for(i=0;i<2*n;i+=2)
clipb(polyy[i],polyy[i+1],polyy[i+2],polyy[i+3]);
for(i=0;i<k;i++)
poly[i]=round(arr[i]);
if(k)
fillpoly(k/2,poly);
rectangle(xmin,ymax,xmax,ymin);
printf("\tCLIPPED POLYGON");
getch();
closegraph();
}

Wednesday, March 20, 2013

Cohen-Sutherland's Line clipping in C


//line clipping
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#include<dos.h>
#define MAX 20
void cohen_sutherlands(double,double,double,double,double,double,double,double);
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;
}

void cohen_sutherlands(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;
   }
   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 if(outcode_ex&LEFT)
   {
    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);
}
//fms
void main()
{
 int n,i,j;
 int ln[MAX][4];
 int clip[4];
 int gd=DETECT,gm;
 printf("\nenter the no. of lines to be clipped");
 scanf("%d",&n);
 printf("\nEnter the x & y coordinates of line end points");
 for(i=0;i<n;i++)
 for(j=0;j<4;j++)
 scanf("%d",&ln[i][j]);
 printf("\nEnter the x & y coordinates of left top & right bottom");
 for(i=0;i<4;j++)
 scanf("%d",&clip[i]);
 initgraph(&gd,&gm,"c:\\tc\\bgi");
 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_sutherlands(ln[i][0],ln[i][1],ln[i][2],ln[i][3],clip[0],clip[1],clip[2],clip[3]);
  getch();
 }
 closegraph();
}

Saturday, March 2, 2013

Traffic System using GRAPHICS in C


//Traffic System
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>

void traf(int,int,int);
void car(int);

void main()
{
 int gd=DETECT,gm,i;
 initgraph(&gd,&gm,"c:\\tc\\bgi");
 for(i=0;i<650;i++)
 {
  if(i!=150)
  {
   traf(0,0,2);
   setcolor(6);
   car(i);
   delay(15);
   cleardevice();
  }
  else
  {
   traf(4,0,0);
   setcolor(6);
   car(i);
   delay(3500);
   traf(0,0,2);
  }
 }
 getch();
}

void traf(int r,int y,int g)
{
 cleardevice();
 setcolor(6);
 rectangle(490,50,530,110);
 setfillstyle(1,r);
 fillellipse(510,60,10,10);
 setfillstyle(1,y);
 fillellipse(510,80,10,10);
 setfillstyle(1,g);
 fillellipse(510,100,10,10);
 setcolor(4);
 line(505,110,505,200);
 line(515,110,515,200);
 setcolor(15);
 line(0,200,getmaxx(),200);
 line(0,416,getmaxx(),416);
}

void car(int i)
{
 ellipse(125+i,320,0,180,50,25);
 line(41+i,320,75+i,320);
 line(175+i,320,208+i,320);
 arc(75+i,328,165,216,36);
 line(45+i,350,205+i,350);
 arc(175+i,328,320,373,36);
 circle(80+i,360,10);
 circle(160+i,360,10);
}

Monday, February 11, 2013

JavaScript program to display todays date


<!--fms-->
<html>
<head>
<script>
function displayDate()
{
document.getElementById("demo").innerHTML=Date();
}
</script>
</head>
<body>

<h1>JavaScript to display date</h1>
<p id="demo">This is a paragraph.</p>

<button type="button" onclick="displayDate()">Display Date</button>

</body>
</html>

jsp to display todays day of the week


<!--fms-->
<html>
<body>

<p id="demo">Click the button to display todays day of the week.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction()
{
var d = new Date();
var weekday=new Array(7);
weekday[0]="Today is Sunday";
weekday[1]="Today is Monday";
weekday[2]="Today is Tuesday";
weekday[3]="Today is Wednesday";
weekday[4]="Today is Thursday";
weekday[5]="Today is Friday";
weekday[6]="Today is Saturday";

var x = document.getElementById("demo");
x.innerHTML=weekday[d.getDay()];
}
</script>

</body>
</html>

Sunday, February 10, 2013

jsp program to display clock


<!jsp program to display clock!>
<!DOCTYPE html>
<html>
<head>
<script>
function startTime()
{
  var today=new Date();
  var h=today.getHours();
  var m=today.getMinutes();
  var s=today.getSeconds();
  // add a zero in front of numbers<10
  m=checkTime(m);
  s=checkTime(s);
  document.getElementById('txt').innerHTML=h+":"+m+":"+s;
  t=setTimeout(function(){startTime()},500);
}

function checkTime(i)
{
   if (i<10)
   {
      i="0" + i;
   }
   return i;
}
</script>
</head>

<body onload="startTime()">
<div id="txt"></div>
</body>
</html>

Wednesday, January 30, 2013

Code for Program to rotate about reference point in C++ Programming


Code for Program to rotate about reference point in C++ Programming
# include <iostream.h>
# include <conio.h>
# include <graphics.h>
# include <math.h>

char IncFlag;
int PolygonPoints[4][2] =
    {{10,100},{110,100},{110,200},{10,200}};

int RefX = 10;
int RefY = 100;

void PolyLine()
{
    int iCnt;
    cleardevice();
    line(0,240,640,240);
    line(320,0,320,480);
    for (iCnt=0; iCnt<4; iCnt++)
    {
        line(PolygonPoints[iCnt][0],PolygonPoints[iCnt][1],
          PolygonPoints[(iCnt+1)%4][0],PolygonPoints[(iCnt+1)%4][1]);
    }
}

void Translate(int Direction)
{
    int iCnt;
    for (iCnt=0; iCnt<4; iCnt++)
    {
        PolygonPoints[iCnt][0] += Direction*RefX;
        PolygonPoints[iCnt][1] -= Direction*RefY;
    }
}

void Rotate()
{
    float Angle;
    int iCnt;
    int Tx,Ty;
    Translate(-1);
    cout<<endl;
    Angle = 30.0*(22.0/7.0)/180.0;
    for (iCnt=0; iCnt<4; iCnt++)
    {
        Tx = PolygonPoints[iCnt][0];
        Ty = PolygonPoints[iCnt][1];
        PolygonPoints[iCnt][0] = (Tx - 320)*cos(Angle) -
                     (Ty - 240)*sin(Angle) + 320;
        PolygonPoints[iCnt][1] = (Tx - 320)*sin(Angle) +
                     (Ty - 240)*cos(Angle) + 240;
    }
    Translate(1);
}

void main()
{
    int gDriver = DETECT, gMode;
    int iCnt;
    initgraph(&gDriver, &gMode, "C:\\TC\\BGI");
    for (iCnt=0; iCnt<4; iCnt++)
    {
        PolygonPoints[iCnt][0] += 320;
        PolygonPoints[iCnt][1] = 240 - PolygonPoints[iCnt][1];
    }
    PolyLine();
    getch();
    Rotate();
    PolyLine();
    getch();

Friday, January 25, 2013

Cascading Style Sheet inline & internal example


<!--Example of Cascading Style Sheet with inline & internal....fensasaj@blogspot.com-->
<html>
<head>
<style>
body
{
background-color:lightblue;
}
h1
{
color:red;
text-align:center;
}
h4
{
text-align:left;
background-color:pink;
color:green;
}
p
{
font-family:"Palace Script MT";
font-size:70px;
color:blue;
}
</style>
</head>
<body>
<h1>WELCOME</h1>
<h4>Log onto e-mail</h4>
<p>This is first page...........................
Welcome to first page...........................
Keep trying.....................................
</p>
</body>
</html>