Posts

The process of attempting to gain or successfully gaining, unauthorised access to computer resourc

Image
How to draw a rectangle in c graphics ? And simple math behind the rectangle function in c graphics To draw a rectangle in c graphics we will use rectangle ( ), graphics . h header file, and some graphic driver codes to initialize graphic mode. Here in this code, you can see there are four arguments are present within rectangle( ). rectangle(150,150,350,250).So here you have to pass four arguments within rectangle( ). rectangle(150,150,350,250); To understand the rectangle( ), and arguments of rectangle( ), let us consider the rectangle function like this. void rectangle(int left,int top,int right,int bottom); or rectangle( left,top,right,bottom);  To draw a rectangle in c graphics we need two coordinates, so the left top of the rectangle will be the first coordinate and the right bottom of the rectangle will be the second coordinate of the rectangle. rectangle(left,top,right,bottom); or rectangle(150,150,350,250); #include<stdio.h> #include<graphi
Image
How to draw an arc in c graphics? To draw an arc in c/c++ we will use graphics.h header file, circle( ) ,   and some graphic driver codes to initialize the graphic mode. to understand an arc function and arguments of arc function you have to understand the simple maths behind it. Here in this source code, you can see an arc( ), there are five arguments are present within arc( ). so here now you have to pass five arguments within arc function arc(300,250,180,360,50); To understand the arc( ) and arguments of arc( ), we will consider the arc( ) like this, void arc(int x ,int y ,int a , int b ,int r );   or   arc( x , y , a , b , r );  Here x and y are the coordinate and centre of the arc, where  a is the starting angle, and b is the end angle of the arc, and the last arguments  r is the radius of the arc. to understand the starting angle and end angle please have a look on the graph given below. This is the graphical representation 360* protractor, here you can se
Image
How to draw a circle in c/c++ ? To understand the graphics program you must need to understand the simple math behind graphics programming. To draw a circle in c/c++ we use graphics.h header file,  circle( )  and some graphic driver codes to initialize the graphic mode. Here in this source code, you can see circle( ), there are three arguments are present within circle( ). so here now you have to pass three arguments within circle( ). circle(300,250,50); to understand circle( ) and arguments of circle( ),we will consider the circle( ) like this. void circle(int x,int y,int r); or circle(x,y,r);  Here you can see there are three arguments are present within the circle( ). These arguments are the coordinates and radius of the circle function. First, two arguments  x = 300 and y = 250 make a point and centre of the circle, and last argument  r = 50 is a radius, through which the c
Image
How to draw lines ?  And basic maths to draw lines in graphics programming with c graphics . To understand the graphics program you must need to understand the simple math behind graphics programming.  To draw lines in c, especially we need graphics.h header file, line( ) , and some graphic driver codes to initialize the graph . #include<conio.h> #include<graphics.h> void main( ) { clrscr( ); int gd=DETECT,gm; initgraph(&gd,&gm, "c:\\tc\\bgi") ; line(100,200,400,300); getch( ); closegraph( ); } Here in this code you can see  line function, there are four arguments are present within line ( ), so now here you have to pass four arguments within line ( ); line(100,200,400,300); to understand the line( ) and arguments of line( ),we will consider the line( ) like this. void line(int x1 ,int y1 ,int x2 ,int y2 );  or   line( x1 , y1 , x2 , y2 ); here you can see four int type arguments are present within line function. These a
Image
How to fix output related problems ? If your system is not giving any output after compiling the source code, then follow the given steps. As you can see in initgraph( ),there is a term, "c:\\tc\\bgi"   this is basically a driver_directory _path where all the graphic driver files are located. But there is a little problem due to which the source code is not giving any output after compiling the code, and you can fix this problem by copying all files of bgi folder to bin  folder. for your  convenience and simplicity,  I am providing you some screenshots of the whole process Here I am using YOGISOFT c++, if you are using TURBO c++ or DEV c++, the process is the same for all compilers, some files may differ in other compilers. But we shouldn't worry about it simply go to C drive and go to c++ folder and then go to tc folder, click on bgi folder and copy all the files of bgi folder to bin folder.  click on your local disk or c drive

Graphics with c/c++

Image
Graphics with c/c++............... In this type of programming, we can draw different kinds of geometrical shapes circle, rectangle, square, lines, etc with different colors .we can also create animation and games by writing and compiling some programming code with the help of c/c++ compiler So here i am trying to provide you some important point which we will use in whole graphics programming  #include<graphics.h> * graphics.h library function is used to include and facilitate graphical operation in the program  * there are many predefined functions in graphics.h library,such as line( ),circle( ),arc( ) and many more function .we will use these functions according to the need and requirement. The main programming section to initialize the graph................ gd - gd means graphic driver gm - gm means graphic mode, which is a computer display mode that generates images using pixels DETECT - DETECT is a macro defined in " graphics.h "