How To Creat Indian And Bangladeshi National Flag Using C or C++:
Hello Friends. How Are You ? I think You are interested in programming?
Today I will Show You How Creat BD & Indian National Flag using Turbo C&C++ Or Codeblocks..
bd / Indian flag C/C++ Project tutorial and guide for developing code.
Related Contents:
So Lets Start.
Creat Indian Flag Using C & C++ Or Codeblocks Programing
Creat Indian And Bangladeshi National Flag Using C
|
Hello Friends. How Are You I think You are good .
Today I will Show You How Creat Indian National Flag using Turbo C&C++ Or Codeblocks..
Search on google for Codeblocks apps
Indian flag C/C++ Project tutorial and guide for developing code.
Indian flag Screen Shot.
We have project collection of C/C++ with source code.
So Lets Start ..
Step By Step…
1.first need a Computer Or Laptop.
2.Need Turbo/codeblocks
3.open this apps.
and write This program….
I will Show Practically. first i creat this flag then i give screenshot.
Program Is Here...
How Creat Indian national Flag Using C&C++ and codeblocks.
#include<stdio.h>
#include<graphics.h>
#include<math.h>
int gd,gm;
int main()
{
float PI=3.14;
int r,i,a,b,x,y;
initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");
detectgraph(&gd,&gm);
setcolor(RED);
//draw the top rectangle and color it
floodfill(101,101,RED);
rectangle(100,100,450,150);
setfillstyle(SOLID_FILL,RED);
rectangle(100,150,450,200);
//draw the middle rectangle and color it
setcolor(WHITE);
rectangle(100,200,450,250);
setfillstyle(SOLID_FILL,WHITE);
floodfill(101,151,WHITE);
//draw the bottom rectangle and color it
setcolor(GREEN);
r=25; //radius
setfillstyle(SOLID_FILL,GREEN);
floodfill(101,201,GREEN);
a=275; //center
//draw the circle
b=175; //center
line(a,b,a+x,b-y);
setcolor(BLUE);
circle(a,b,r);
for(i=0;i<=360;i=i+15)
//spokes
{
y=r*sin(i*PI/180);
x=r*cos(i*PI/180);
}
}
getch();
closegraph();
return 0;
Or.
You Can Use This Code...
#include "afxwin.h"
#include <math.h>
class CMyApp : public CWinApp
{
public:
virtual BOOL InitInstance ();
};
class CMainWindow : public CFrameWnd
{
public:
CMainWindow();
protected:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP();
};
CMyApp myAPP;
BOOL CMyApp::InitInstance()
{
m_pMainWnd = new CMainWindow;
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
CMainWindow::CMainWindow ()
{
Create(NULL,_T("India's Flag"), WS_OVERLAPPEDWINDOW );
}
void IndiaFlag(CDC &dc, int x, int y)
{
dc.SetBkMode(TRANSPARENT);
CRect rect;
CPen pen(PS_SOLID, 1, RGB(0,0,0));
CPen *oldPen = dc.SelectObject(&pen);
{
CBrush brush(RGB(255,130,0));
CBrush *oldBrush = dc.SelectObject(&brush);
dc.Rectangle(x,y,x+200,(y+50));
}
{
CBrush brush(RGB(255,255,255));
CBrush *oldBrush = dc.SelectObject(&brush);
dc.Rectangle(x,(y+50),(x+200),(y+100));
CPen pen2(PS_SOLID, 1,RGB(0,0,255));
CPen *oldPen = dc.SelectObject(&pen2);
dc.Ellipse((x+75),(y+50),(x+125),(y+100));
double Nx,Ny;
for (int angle=0;angle<360; angle+=15)
{
int angle2 = angle;
double length = 25*(cos(double(angle2 *(3.14159265 / 180))));
double len2 = 25*(sin(double(angle2 *(3.14159265 / 180))));
int originX = (x+100);
int originY = (y+75);
Nx = originX + length;
Ny = originY - len2;
dc.MoveTo(originX,originY);
dc.LineTo(Nx,Ny);
}
}
{
CBrush brush(RGB(34,139,34));
CBrush *oldBrush = dc.SelectObject(&brush);
dc.Rectangle(x,(y+100),(x+200),(y+150));
}
}
void CMainWindow::OnPaint ()
{
CPaintDC dc(this);
IndiaFlag(dc, 150, 150);
}
How Creat Bangladesh national flag Using Turbo C &C++ or codeblocks:
Hello Viewers Today i will show how creat bangladeshi national flag using codeblocks and Turbo C And Turbo C++...
Bangladesh national flag Using Turbo C
|
Many people request me for that.
so i expalin that how creat bangladeshi national flag using codeblocks and Turbo C And Turbo C++...
i Will Show You step By Step....
So Lets Start...
1.first need a Computer Or Laptop.
2.Need Turbo/codeblocks
3.open this apps.
and write This program....
Install Turbo C++/Code blocks (Graphic version) and follow the code...
#include<graphics.h>
#include<conio.h>
main(){
int driver,mode;
driver=DETECT;
mode=0;
initgraph(&driver,&mode,"c:\\tc\\bgi");
setbkcolor(WHITE);
setcolor(WHITE);
rectangle(150,40,450,180);
setfillstyle(1,GREEN);
floodfill(160,50,WHITE);
setcolor(WHITE);
rectangle(138,35,150,450);
setfillstyle(1,BLUE);
floodfill(140,40,WHITE);
setcolor(WHITE);
bar(130,450,160,460);
setcolor(WHITE);
circle(300,110,55);
setfillstyle(1,RED);
floodfill(320,120,WHITE);
getch();}
Or you can use thius code . if you have any problem in graphics you can use it..
//Including graphics library
#include<graphics.h>
//Including standard input output library
#include <stdio.h>
//Main function
void main(){
//Initializing graphics
int driver=DETECT, mode=0;
initgraph(&driver, &mode, NULL);
//setcolor function is used to change the current drawing color
//We're changing it to green
setcolor(GREEN);
//rectangle function is used to draw a rectangle
//left, top, right and bottom is required to draw a rectangle
rectangle(40,80, 600, 400);
//floodfill function is used to fill the area.
floodfill(320, 240, GREEN);
setcolor(RED);
//circle function is used to draw a circle
//left, top and a radius is required to draw a circle
circle(320, 240, 100);
floodfill(320, 240, RED);
setcolor(YELLOW);
//Drawing a line from 600,80 to 600, 480
line(600, 80, 600, 480);
//Waiting for keyboard input. Without this the screen will close in a matter of seceond.
getchar();
}