answersLogoWhite

0


Best Answer

/*this code is developed in dev-c++*/

#include <cstdlib>

#include <iostream>

#include<graphics.h>

#include<cmath>

#define pi 3.1415

using namespace std;

int x=300,y=250;

void rotate()

{

//setcolor(BLACK);

setfillstyle(SOLID_FILL,COLOR(255,165,0));

rectangle(100,100,500,200);

putpixel(150,150,RED);

floodfill(150,150, getmaxcolor());

setfillstyle(SOLID_FILL,WHITE);

rectangle(100,200,500,300);

floodfill(250,250, getmaxcolor());

setfillstyle(SOLID_FILL,GREEN);

rectangle(100,300,500,400);

floodfill(350,350, getmaxcolor());

int a=0;

for(int i=0;i<360;i+=15)

{

setcolor(BLACK);

circle(x,y,45);

double in=2*pi*(a+i)/360;

int xc=x+45*cos(in);

int yc=y+45*sin(in);

line(x,y,xc,yc);

}

setfillstyle(SOLID_FILL,BLACK);

}

int main(int argc, char *argv[])

{

initwindow(600,500, " flag");

rotate();

system("PAUSE");

return EXIT_SUCCESS;

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C graphic program to Draw Indian Flag?
Write your answer...
Submit
Still have questions?
magnify glass
imp