Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

A Micro Project On 2020-21: Display Moving Car

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

A Micro Project On 2020-21

DISPLAY MOVING CAR


By
1.Pooja Gokul Mahale

2.Darshana Vitthal Mali

3.Mohit Deepak More


Under the Guidance of,

Prof. D.D.Borse

Department of Computer Engineering,

Sau.Shantidevi Chavan Polytechnic, Bhoras

2020-21
Sau.Shantidevi Chavan Institute of Polytechnic, Bhoras

Chalisgaon-424101

CERTIFICATE
This is to certify that Mr. Mohit Deepak More has successfully completed the
micro Project on “DISPLAY MOVING CAR” under my supervision in the
partially fulfillment of diploma of engineering (computer)of Sau.Shantidevi
Chavan Institute Polytechnic, Bhoras.

Date:

Place:

Prof. D.D.Borse Prof.Y.K. Pardeshi Prof.D.A.Patil


Project Guide HOD PRINCIPAL
Sau.Shantidevi Chavan Institute of Polytechnic, Bhoras

Chalisgaon-424101

CERTIFICATE
This is to certify that Ms.Darshana Vitthal Mali has successfully completed the
micro Project on “DISPLAY MOVING CAR” under my supervision in the
partially fulfillment of diploma of engineering (computer)of Sau.Shantidevi
Chavan Institute Polytechnic,Bhoras.

Date:

Place:

Prof. D.D.Borse Prof.Y.K.Pardeshi Prof.D.A.Patil


Project Guide HOD PRINCIPAL
Sau.Shantidevi Chavan Institute of Polytechnic,Bhoras

Chalisgaon-424101

CERTIFICATE
This is to certify that Ms.Pooja Gokul Mahale has successfully completed the
micro Project on “DISPLAY MOVING CAR” under my supervision in the
partially fulfillment of diploma of engineering (computer)of Sau.Shantidevi
Chavan Institute Polytechnic,Bhoras.

Date:

Place:

Prof. D.D.Borse Prof.Y.K.Pardeshi Prof.D.A.Patil


Project Guide HOD PRINCIPAL
INDEX

Sr. Pg
TOPIC
No no

1 INTRODUCTION 2

2 FUNCTIONS 3

3 SYSTEM REQUIREMENT 4

4 PROGRAM 5

5 OUTPUT 9

6 REFERENCE 10
INTRODUCTION

Program in C using graphics to move a car. A car is made


using two rectangles and two circles which act as tires of the car.
A for loop is used to move the car forward by changing the
rectangle and circle coordinates and erasing the previous contents
on screen using clearviewport, you can also use clear device.
Speed of car can be adjusted using delay function, more the delay
lesser will be the speed or lesser the delay your car will move fast.
In this program color of the car also keeps on changing,
this is accomplished by incrementing the color value by one each
time in the for loop, you can also use random function for this
purpose. Before you see a car moving you will be asked to press
a key.
FUNCTIONS

delay(n): This function is used for holding the program output


for a small period of time since processing is very fast so use it to
see the result.

setcolor(n): A function from graphics.h header file which set the


color of the pointer (cursor). There are some predefined colors in
computer graphics. Here n is color number.

line(x1, y1, x2, y2): A function from graphics.h header file which
draw a line with (x1, y1) as first coordinate of line and (x2, y2)
as second coordinate of the line.

circle(x, y, r): A function from graphics.h header file which draw


a circle with center (x, y) and radius
SYSTEM REQUIREMENTS

HARDWARE REQUIREMENT
1920 x 1080 or greater screen resolution.
Windows 10 Operating System
500 GB or larger SSD.
Minimum 4 GB of RAM

SOFTWARE REQUIREMENT
TRUBO C/C++ SOFTWARE
PROGRAM
#include <graphics.h>
#include <stdio.h>

// Function to draw moving car


void draw_moving_car(void) {

int i, j = 0, gd = DETECT, gm;

// Passed three arguments to initgraph


// function to initialize graphics mode
initgraph(&gd, &gm, "");

for (i = 0; i <= 420; i = i + 10) {

// Set color of car as red


setcolor(RED);
// Thease lines for bonnet and
// body of car
line(0 + i, 300, 210 + i, 300);
line(50 + i, 300, 75 + i, 270);
line(75 + i, 270, 150 + i, 270);
line(150 + i, 270, 165 + i, 300);
line(0 + i, 300, 0 + i, 330);
line(210 + i, 300, 210 + i, 330);

// For left wheel of car


circle(65 + i, 330, 15);
circle(65 + i, 330, 2);

// For right wheel of car


circle(145 + i, 330, 15);
circle(145 + i, 330, 2);

// Line left of left wheel


line(0 + i, 330, 50 + i, 330);

// Line middle of both wheel


line(80 + i, 330, 130 + i, 330);

// Line right of right wheel


line(210 + i, 330, 160 + i, 330);

delay(100);

// To erase previous drawn car, draw


// the whole car at same possition
// but color using black
setcolor(BLACK);

// Lines for bonnet and body of car


line(0 + i, 300, 210 + i, 300);
line(50 + i, 300, 75 + i, 270);
line(75 + i, 270, 150 + i, 270);
line(150 + i, 270, 165 + i, 300);
line(0 + i, 300, 0 + i, 330);
line(210 + i, 300, 210 + i, 330);

// For left wheel of car


circle(65 + i, 330, 15);
circle(65 + i, 330, 2);

// For right wheel of car


circle(145 + i, 330, 15);
circle(145 + i, 330, 2);

// Line left of left wheel


line(0 + i, 330, 50 + i, 330);

// Line middle of both wheel


line(80 + i, 330, 130 + i, 330);
// Line right of right wheel
line(210 + i, 330, 160 + i, 330);
}

getch();

closegraph();
}

// Driver code
int main()
{
draw_moving_car();

return 0; }
OUTPUT
References

https://www.youtube.com/results?search_query=display+movin
g+car+project+conclusion
https://www.geeksforgeeks.org/draw-a-moving-car-using-
computer-graphics-programming-in-c/
https://www.programmingsimplified.com/c/program/moving-car

You might also like