0% found this document useful (0 votes)
2 views2 pages

Assignment No 7

The document contains a C++ program that utilizes graphics to animate a walking man and display random text on the screen. It defines a class 'walkingman' with methods to draw the walking animation and random text at specified coordinates. The main function initializes the graphics and repeatedly calls the drawing methods to create the animation effect.

Uploaded by

swamipravi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Assignment No 7

The document contains a C++ program that utilizes graphics to animate a walking man and display random text on the screen. It defines a class 'walkingman' with methods to draw the walking animation and random text at specified coordinates. The main function initializes the graphics and repeatedly calls the drawing methods to create the animation effect.

Uploaded by

swamipravi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment No 7

Roll No : 59

#include<iostream>
//#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
//#include<dos.h>
using namespace std;
class walkingman
{
int rhx,rhy;
public:
void draw(int,int);
void draw(int);
};
void walkingman::draw(int i)
{
line(20,380,580,380);
if(i%2)
{
line(25+i,380,35+i,340);//left leg
line(45+i,380,35+i,340);//right leg
line(35+i,310,25+i,330);//left hand
delay(20);
}
else
{
line(35+i,340,35+i,310);
line(35+i,310,40+i,330);
delay(20);
}
line(35+i,340,35+i,310);
circle(35+i,300,10);
line(35+i,310,50+i,330);//right hand
line(50+i,330,50+i,280);
line(15+i,280,85+i,280);//umbrella line
arc(50+i,280,180,0,35);
arc(50+i,245,180,0,5);
arc(55+i,330,0,180,5);
}
void walkingman::draw(int x,int y)
{
int j;
rhx=x;
rhy=y;
for
(j=0;j<100;j++)
{
outtextxy(rand()%rhx,rand()%(rhy-50),"|");
setcolor(WHITE);
}
}
int main()
{
int gd=DETECT,gm;
int rhx,rhy,j,i;
walkingman obj;
initgraph(&gd,&gm,NULL);
for(i=0;i<500;i++)
{
obj.draw(i);
rhx=getmaxx();
rhy=getmaxy();
obj.draw(rhx,rhy);
delay(150);
cleardevice();
}
getch();
}

You might also like