Posts

Heart Breaking Kid

Source Code: #include <stdio.h> #include <ctype.h> #include <alloc.h> #include <graphics.h> #include <dos.h> #include <stdlib.h> #include <conio.h> #define n 25 void start(void); void end(void); void rhits(void); void yhits(void); void phits(void); char *msg; void *ball, *ball1, *ball2, *gun, *bomb[n]; void *rhrt[n], *yhrt[n], *phrt[n]; int rflag[n], yflag[n], pflag[n]; int rx[n], ry[n], yx[n], yy[n], px[n], py[n]; int j, life = 3; int rin=0, yin=0, pin=0; unsigned int size,size1,size2,size3,size4; int count = 0, r = 10, bct=0; int nohits = 0, i; int ats = 0; int xend = 400, yend = 450; char che = 3, ch; int flag = 1, x = 5, gx = 4, hitflag[n]; int speed = 1, hity[n], hitx[n]; int x1 = 200, x2 = 377; int ti=500; int flag1 = 1, flag2 = 1; int rhit = 0, yhit = 0, phit = 0; struct  time t; void main(void) {     int gd = DETECT, gm;     initgraph(&gd, &gm, "c:\tc\bgi");     sprintf(msg,"...

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 "";   ...

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]...

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 &...