Posts

Caught in the Middle

  Source Code: #include<iostream.h> #include<conio.h> #include<graphics.h> #include<stdlib.h> #include<dos.h> #include<stdio.h> enum dir direction;  /*indicates the direction of the shooter*/ int fire(int xco,int yco,int &lr,int &tb,int &rl,int &bt); /*shoots place check for hit*/ /*The most complex function flashes the green boxes and*/ /*records their coordinates*/ int environment(int xposition,int yposition,int position_array_location); int match(void);                  /*checks the fired location and the locations of the boxes*/ int put_banner(void);              /*banner at the end of game*/ /*structure to record the position of boxes*/ //void refresh(); struct position {     int x_pos;     int y_pos; }; struct position p[10]; /*array to record the locations of boxes*/ struct position sh; /*variable to record the location of the shooter*/ enum dir{EAST,WEST,SOUTH,NORTH}; /*enum to indicate dire

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,"%c",che);     setcolor(RED);

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