Computer graphics program for a man walking in rain with an umbrella

computer graphics program for a man walking in rain with an umbrella. learn step by step with a full explanation. Computer graphics C program to show a man walking in rain with an umbrella

C program to show a man walking in rain

 

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

#define ScreenWidth getmaxx()
#define ScreenHeight getmaxy()
#define GroundY ScreenHeight*0.74
//Use *1 for full screen

int ldisp=0;

void DrawManAndUmbrella(int x,int ldisp)
{
//head
circle(x,GroundY-90,10);
line(x,GroundY-80,x,GroundY-30);
//hand
line(x,GroundY-70,x+10,GroundY-60);
line(x,GroundY-65,x+10,GroundY-55);
line(x+10,GroundY-60,x+20,GroundY-70);
line(x+10,GroundY-55,x+20,GroundY-70);
//legs
line(x,GroundY-30,x+ldisp,GroundY);
line(x,GroundY-30,x-ldisp,GroundY);
//umbrella
pieslice(x+20,GroundY-120,0,180,40);
line(x+20,GroundY-120,x+20,GroundY-70);
}

void Rain(int x)
{
int i,rx,ry;
for(i=0;i<400;i++)
{
rx=rand() % ScreenWidth;
ry=rand() % ScreenHeight;
if(ry<GroundY-4)
{
if(ry<GroundY-120 || (ry>GroundY-120 && (rx<x-20 || rx>x+60)))
line(rx,ry,rx+0.5,ry+4);
}
}
}
void main()
{
int gd=DETECT,gm,x=0;
 //Change BGI directory according to yours
initgraph(&gd,&gm,C:\\TurboC3\\BGI“);
//If you fill here (0) then you will show like flashlight
while(!kbhit())

{
  //Draw Ground
line(1, GroundY,ScreenWidth,GroundY);
Rain(x);
  // Increase value of(ldisp+4) for Fast moving leg
ldisp=(ldisp+4)%20;
DrawManAndUmbrella(x,ldisp);
delay(75);
cleardevice();
 //If insted of(x+1) you use(x+5) or Decreasing the value moving Fast
x=(x+4)%ScreenWidth;
}
closegraph();
getch();
}

Man walking in rain with umbrella c program

Computer graphics program for a man walking in rain with an umbrella
Computer graphics program for a man walking in rain with an umbrella
Computer graphics program for a man walking in rain with an umbrella
Computer graphics program for a man walking in rain with an umbrella
C program to show a man walking in rain
C program to show a man walking in rain

 

 

 

 

 

 

 

END

C program to draw a square using graphics (clickHere)

 

Note:- Maybe sometime above code doesn’t get user-friendly output, in codeblock ‘or’ any other EDITOR, All of C & C++ program tested in DOS compiler Turbo C.

Also Read

Types of functions in C    Read Here

I hope you will understand better if you study at M.U, in the exam of M.U you know how important this “Computer graphics program for a man walking in rain with an umbrella. So please don’t forget to give your valuable feedback. Go in the comment section and Give us some feedback about it. Computer graphics program for a man walking in rain with an umbrella or My website.

Our team check your every Comment per day Because your one feedback helps us in growing Thesmolt

C program for walking man in the rain

I request you if you have any doubt or question regarding our site, then please don’t hesitate. We always waiting for your Suggestion.

Note:- If you want to Download This article’s in PDF form, then simply go (Top or Bottom of) Right corner and click on the PRINT icon, and it’s saved as a PDF of Computer graphics program for a man walking in rain with an umbrella

 

For further questions, you can contact us Via mail [email protected]  otherwise, Our Help Page and Contact us Page, which is included below. I hope I’ll able to say all the possible ways to reach us. Or Download My Android Application Below Download Button.

thesmolt App

Leave a Reply

x