Program of Road Animation

#include<graphics.h>
#include<iostream.h>
#include<conio.h>

void main()
{
int gd=DETECT, gm, c, d, e, f, g;
clrscr();
initgraph(&gd, &gm, " ");
cout<<"enter 5 colours";
cin>>c>>d>>e>>f>>g;
setcolor(c);
rectangle(100,100,300,150);
setfillstyle(SOLID_FILL,d);
floodfill(120,120,c);
rectangle(100,150,300,200);
setfillstyle(SOLID_FILL,e);
floodfill(120,160,c);
rectangle(100,200,300,250);
line(100,250,100,475);
setfillstyle(SOLID_FILL,f);
floodfill(120,220,c);
circle(200,175,20);
setcolor(g);
line(200,160,200,190);
line(180,175,220,175);
line(190,167,210,183);
line(190,183,210,167);

getch();
closegraph();
}

Post a Comment

2 Comments

  1. Output asks "Enter 5 colours". When i enters 5 colour it doesn't show any road animation,it sends me back to the main program !

    ReplyDelete
  2. Follow the Instructions:
    For all the Graphics Program Do this before you run the program.
    1. Find initgraph(&gd, &gm, ""); in Program.
    2. Write the path of BGI Folder, which there inside TC.
    Like, initgraph(&gd, &gm, "C://TC//BGI");
    or initgraph(&gd, &gm, "C://TurboC++//Disk//TurboC3//BGI");
    3. Copy "EGAVGA.BGI" File from BGI Folder and Paste it to BIN Folder.

    ReplyDelete