Posts

Showing posts from October, 2016

Program for PDA to CFA conversion

Source Code #include<iostream.h> #include<dos.h> #include<stdio.h> #include<stdio.h> #include<conio.h> struct pdastate    {    int type;    char sym;    int trno;    int trans[20];    char tsym[20];    }; class  pda    {    public:       int n;       pdastate s[30];    pda(void)       {       n=0;       }    void show(void);    }; void pda::show(void)    {    pdastate p;    clrscr();    for(int i=0;i<n;i++)       {       p=s[i];       cout<<" " State No " := "<<i;       cout<<" " Tag "";       if(p.type==0)          cout<<" " Start State "";       else          if(p.type==1)             cout<<" " Push "<<p.sym<<""";       else          if(p.type==2)             cout<<" " Pop State "";       else          if(p.type==3)             cout<&

Program for 3-D Transformation

Source Code #include<iostream.h> #include<dos.h> #include<stdio.h> #include<math.h> #include<conio.h> #include<graphics.h> #include<process.h> int gd=DETECT,gm; double x1,x2,y1,y2; void show_message() { char *mess[]={"-","=","["," ","3","D","-","T","r","a","n","s",      "f","o","r","m","a","t","i","o","n"," ","]","=","-"}; int xx=28,xxx=52,i,j; _setcursortype(_NOCURSOR); for(i=0,j=24;i<15,j>=12;i++,j--) { gotoxy(xx,1); cout<<mess[i]; xx++; gotoxy(xxx,1); cout<<mess[j]; xxx--; delay(50); } _setcursortype(_NORMALCURSOR); } void draw_cube(double edge[20][3])       {         initgraph(&gd,&gm,"..\bgi");

Pari man walk and jump

Source Code #include<iostream.h> #include<conio.h> #include<dos.h> #include<stdio.h> #include<graphics.h> #include<math.h> #include<string.h> #include<time.h> float main(void)  {   int*p1,*p2,*p;   clock_t start,end;   time_t t,t1;   int z=0,z1=0;   int gdriver = DETECT, gmode, errorcode;   initgraph(&gdriver, &gmode, "");   int r=0;   int ch,x=10,y=350;   int poly[100],poly1[100],variable1;   setcolor(14);   ellipse(100,105,180,0,10,15);   ellipse(93,125,320,50,3,7);   ellipse(105,125,130,270,3,7);   ellipse(110,112,250,90,3,2);   line(93,128,108,133);   putpixel(100,120,4);   poly[0]=105;   poly[1]=105;   poly[2]=103;   poly[3]=108;   poly[4]=101;   poly[5]=109;   poly[6]=101;   poly[7]=111;   poly[8]=100;   poly[9]=108;   poly[10]=98;   poly[11]=108;   poly[12]=96;   poly[13]=111;   poly[14]=96;   poly[15]=119;   poly[16]=88;   poly[17]=113;   poly[18]=89;   poly[19]=1

Moving 3D Box in free space

Source Code #include <stdio.h> #include <dos.h> #include <graphics.h> #include <conio.h> #define MAGFY 20 class Bline { private: int CEN_X,CEN_Y,radius,X,Y,i,j; public: void line1(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4); }; void Bline::line1(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4) { CEN_X = (x1+x2)/2 + (x3-x2)/2; CEN_Y = (y1+y2)/2 + (y3-y2)/2; //radius = (x1+x2)/2; for(;!kbhit();) { delay(300); cleardevice(); //1st box line(x1,y1,x2,y2); line(x1,y1-20,x2,y2-20); // line(x3,y3,x4,y4); line(x3,y3-20,x4,y4-20); // line(x1,y1,x4,y4); line(x1,y1-20,x4,y4-20); // line(x2,y2,x3,y3); line(x2,y2-20,x3,y3-20); // //2nd box line(x1,y1,x1,y1-20); line(x2,y2,x2,y2-20); line(x3,y3,x3,y3-20); line(x4,y4,x4,y4-20); //some point which will be moving around 3Dbox //line(x2+40,y2-20,x2+40,y2-20); //rectangle(x2,y2,x4,y4); //1st Quadrant if(x1>CEN_X &&

Micky Mouse Program

Source Code #include<graphics.h> #include<dos.h> #include<conio.h> #include<alloc.h> void  *buf; void firstleft(); void secondleft(); void main() { int gd=DETECT,gm,i=0,x,y,area; initgraph(&gd,&gm,"tc:\bgi");\put your directory contains egavga.bgi rectangle(0,0,getmaxx(),getmaxy()); arc(240,120,40,140,70); ellipse(165,80,10,280,20,20); ellipse(315,80,-100,170,20,20); arc(235,120,163,215,70); arc(245,120,-35,17,70); ellipse(193,178,85,280,40,20); ellipse(283,178,-100,95,40,20); ellipse(238,199,180,0,39,50); ellipse(213,123,44,240,33,40); ellipse(262,123,-60,135,33,40); ellipse(210,123,0,360,13,20);//left eye ellipse(265,123,0,360,13,20);//right eye ellipse(210,133,0,360,10,10);//left eye ball ellipse(265,133,0,360,10,10);//right eye ball ellipse(210,133,0,360,3,3);//left eye ball ellipse(265,133,0,360,3,3);//right eye ball ellipse(238,160,0,360,10,13);//nose arc(240,125,228,312,68);//mouth arc(240,120,230,310,72)

Logical discription of logial errors in graphics

Source Code #include<iostream.h> #include<conio.h> #include<dos.h> #include<stdio.h> #include<graphics.h> #include<math.h> #include<string.h> #include<time.h> float main(void)  {   int*p1,*p2,*p;   clock_t start,end;   time_t t,t1;   int z=0,z1=0;   int gdriver = DETECT, gmode, errorcode;   initgraph(&gdriver, &gmode, "");   int r=0;   int ch,x=10,y=350;   int poly[100],poly1[100],variable1;   setcolor(14);   ellipse(100,105,180,0,10,15);   ellipse(93,125,320,50,3,7);   ellipse(105,125,130,270,3,7);   ellipse(110,112,250,90,3,2);   line(93,128,108,133);   putpixel(100,120,4);   poly[0]=105;   poly[1]=105;   poly[2]=103;   poly[3]=108;   poly[4]=101;   poly[5]=109;   poly[6]=101;   poly[7]=111;   poly[8]=100;   poly[9]=108;   poly[10]=98;   poly[11]=108;   poly[12]=96;   poly[13]=111;   poly[14]=96;   poly[15]=119;   poly[16]=88;   poly[17]=113;   poly[18]=89;   poly[19]=105