answersLogoWhite

0


Best Answer

// INDIAN FLAG : SIMPLE PROGRAM //

#include<graphics.h>

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

int gdriver=DETECT, gmode, xc=195, yc=175;

double deg, max, x, y, newx, newy, i, move;

initgraph (&gdriver, &gmode, "--path--");

rectangle (100, 100, 300, 250);

rectangle (90, 100, 100, 400);

line (100, 150, 300, 150);

line (100, 200, 300, 200);

setfillstyle (SOLID_FILL, LIGHTRED);

floodfill (110, 110, WHITE);

setfillstyle (SOLID_FILL, WHITE);

floodfill (110, 160, WHITE);

setfillstyle (SOLID_FILL, GREEN);

floodfill (110, 210, WHITE);

setfillstyle (SOLID_FILL, BROWN);

floodfill (91, 101, WHITE);

setcolor (BLUE);

circle (xc, yc, 20);

deg= (double)(15 * 3.14 / 180);

max= (double)(360 * 3.14 / 180);

move= deg;

x= xc;

y= 155;

line (xc, yc, x, y);

for (i= deg; i<= max; i+= move)

{

newx= xc + (x-xc)*cos(i) + (y-yc)*sin(i);

newy= yc - (x-xc)*sin(i) + (y-yc)*cos(i);

line (xc, yc, newx, newy);

}

putpixel (xc, yc, 15);

delay (500);

getch ();

closegraph ();

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

7y ago

If you want to use classes you need to use an object-oriented language, such as C++ or Java.

To create a flag class you will need a base class (flag) plus some derived classes to cater for common layouts such as tricolours and Saltires. The Indian national flag is derived from a horizontal tricolour with orange, white and green bands of equal width. In the centre of the white band there is an Ashoka Chakra, a 24 spoked Wheel of Life.

The Ashoka Chakra is the hardest part to implement, however the geometry is reasonably simple and can be achieved by overlaying a white circle on top of a slightly larger blue circle to create the outer blue ring, with blue quadrilaterals for the spokes. There are 24 spokes in total so these need to be arranged at 15 degree intervals from top centre. There are also 24 semi-circles around the inner edge of the blue ring, but these can be drawn using small blue circles centred on the large white circle's circumference. The diameter of these circles is equal to the circumference of the inner edge divided by 48. The semi-circles also sit between the spokes, so the first semi-circle will be centred 7.5 degrees from top centre, with 15 degree intervals thereafter.

The spokes are formed from diamond-shaped quadrilaterals. If we imagine a circle that is half the diameter of the inner white circle, then its circumference will intersect the mid-points which should be about 3 degrees either side of the outer and inner points. The outer point should hit an imaginary circle with a diameter that is equal to the white inner circle minus one of the small blue circles while the inner point should start on a circle that is roughly twice the diameter of a small blue circle. The first spoke has inner and outer points 0 degrees from top centre while the points of each subsequent spoke are offset 15 degrees from the points of the previous one.

Your graphics library should provide all the facilities you need, which is essentially filled polygons and circles. However, to avoid any flickering during a resize, you should use double-buffering to calculate the geometry and draw the flag in memory before bit-blasting the complete image to the view port for display.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a graphics program of Indian flag using class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you implement a program to display the Indian flag with colors using c graphics?

ANSI/ISO C does not and never has done graphics.


Write a program that accepts as inputs the edges of a graph and then draws the graph using a computer graphics display?

hey i m going to give a program that accepts edges a input and then it draws the graph using a computer graphics display...


How do you run graphics program in C?

pro c language to implement linear search using pointers


Write a program to find the grade obtained by the students of a class using structure?

Write a program to find the grade obtained by the students of a class


How do you capture screenshots in Twitter?

The same way you capture screenshots of anything on your computer. If you are using windows: Press the "PrtScn" button. Then open a graphics program (such as paint) and paste the image. If you are using Mac: Press the Apple key &acirc;&OElig;&tilde; + Shift + 3 and then release. Then, again, open a graphics program and paste.


Are there graphics included in a Service Oriented Architecture program?

Service Oriented Architecture programs do not include graphics. They communicate using different platforms and XLM messages within their software services.


Files needed to run openGL program?

In order to run a OpenGL program, you must download and install a program called GLDirect. This program allows you to run OpenGL-based games and other applications using your graphics card's DirectX drivers.


What has the author Rob Krumm written?

Rob Krumm has written: 'Harvard Graphics' -- subject(s): Harvard graphics (Computer program), Harvard graphics (Computer file) 'Using a PS1' -- subject(s): IBM PS/1 (Computer system) 'Expert advisor' -- subject(s): DBase IV (Computer program), Data base management, Database management


Do I need a fancy graphics card for doing house 3d designes?

This depends on what CAD program you'll be using, but generally speaking you don't need a very robust or recent graphics card to do 3D house designs.


What is classpath and path in java?

if you are using the IDE then there is no need to set class path, ant you are using Command prompt to run the java program then you need to set the class path where the class (which is going to be used in your program) is actually located,use the following command:set calsspath=%classpath%;actual_path_of the class;we cancall more than two class by using this command by using separator (,)


How can you make a model of the earth without using anything edible any clay or without styrphone balls?

A computer program that utilizes 3D graphics.


What are the graphics function in c with its purposes?

Platform dependent. I guess you are using TurboC; it has a built-in help-system, and it comes with an example program called bgidemo.c