Show Mobile Navigation

Monday, April 30, 2012

A Simple Car in Graphics

Anonymous - 17:10
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm,i;
initgraph(&gd,&gm,"c:\\turboc3\\bgi");
setbkcolor(WHITE);



//body of car

for(i=600;i>0;i--)
{
setcolor(RED);
setfillstyle(SOLID_FILL,RED);
arc(50+i,350,90,270,25);
arc(100+i,300,90,180,25);
line(50+i,325,75+i,325);
line(75+i,325,75+i,300);
line(100+i,275,200+i,275);
ellipse(200+i,312,0,90,24,37);
arc(212+i,362,270,360,12);
line(224+i,312,224+i,362);
line(50+i,375,212+i,375);
floodfill(50+i,350,RED);

//tyers
setcolor(BLUE);
circle(75+i,375,12);
circle(175+i,375,12);
setfillstyle(SOLID_FILL,BLUE);
floodfill(75+i,374,BLUE);
floodfill(75+i,376,BLUE);
floodfill(175+i,374,BLUE);
floodfill(75+i,384,BLUE);
arc(75+i,375,0,180,15);
arc(175+i,375,0,180,15);

//windows
setcolor(WHITE);
rectangle(100+i,290,140+i,330);
rectangle(160+i,290,200+i,330);
setfillstyle(SOLID_FILL,WHITE);
floodfill(101+i,291,WHITE);
floodfill(161+i,291,WHITE);

//logo
setcolor(WHITE);
outtextxy(100+i,350,"Ferrari");
delay(10);
cleardevice();
}
getch();
closegraph();
}

0 comments:

Post a Comment

Comments : Read Them Or Add One to promote us