Posts

Showing posts from June, 2020
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