Compare commits

4 Commits

Author SHA1 Message Date
Sandipan Chatterjee 2ea05ed553 Merge adfe3e074b into d143c60246 2023-12-29 06:50:36 -08:00
Julien Le Coupanec d143c60246 Merge pull request #354 from RomjanHossain/patch-1
swap current line with previous
2023-12-29 15:35:14 +01:00
Romjan D. Hossain 44371217a9 swap current line with previous
it should be `ddkP` instead of `ddkp`
2023-12-24 11:53:04 +06:00
Sandipan Chatterjee adfe3e074b Added graphical program
Described how to implement the graphics pointer and use it.
2022-10-24 00:28:23 +05:30
2 changed files with 100 additions and 1 deletions
+99
View File
@@ -239,3 +239,102 @@ enum enum_type /* enum_name is optional */
/* use dot notation to select a component of a struct or union */
Graphical enviroment
// Using a graphical program
//Example ------------------------------> Drawing a line
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h> // library to use graphical commands
int main()
{
int gd=DETECT,gm; // Initialisation of graphics pointer.
initgraph(&gd,&gm,"c:\\turboc3\\bgi"); // starting the graphical enviroment
int x1,y1,x2,y2;
printf("Enter coordinates of first point");
scanf("%d%d",&x1,&y1);
printf("Enter coordinates of second point");
scanf("%d%d",&x2,&y2);
line( x1 , y1 , x2 , y2 ); // graphics command
closegraph(); // Closing of graphics pointer
return 0;
}
//Example ------------------------------> Drawing a circle
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h> // library to use graphical commands
int main()
{
int gd=DETECT,gm; // Initialisation of graphics pointer.
initgraph(&gd,&gm,"c:\\turboc3\\bgi"); // starting the graphical enviroment
int x1,y1,r;
printf("Enter coordinates of center");
scanf("%d%d",&x1,&y1);
printf("Enter size of radius");
scanf("%d",&r);
circle( x1 , y1 , r ); // graphics command
closegraph(); // Closing of graphics pointer
return 0;
}
//Example ------------------------------> Drawing a rectangle
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h> // header file to use graphical commands
int main()
{
int gd=DETECT,gm; // initialisation of graphics pointer.
initgraph(&gd,&gm,"c:\\turboc3\\bgi"); // starting the graphical enviroment
int x1,y1,r;
printf("Enter coordinates of first point");
scanf("%d%d",&x1,&y1);
printf("Enter coordinates of second point");
scanf("%d%d",&x2,&y2);
printf("Enter coordinates of third point");
scanf("%d%d",&x3,&y3);
printf("Enter coordinates of forth point");
scanf("%d%d",&x4,&y4);
line( x1 , y1 , x2 , y2 ); // graphics command
line( x2 , y2 , x3 , y3 );
line( x3 , y3 , x4 , y4 );
line( x4 , y4 , x1 , y1 );
closegraph(); // closing of graphics pointer
return 0;
}
+1 -1
View File
@@ -105,7 +105,7 @@ gu$ make lowercase until end of line
<< indent line one column to left
== auto-indent current line
ddp swap current line with next
ddkp swap current line with previous
ddkP swap current line with previous
:%retab fix spaces / tabs issues in whole file
:r [name] insert the file [name] below the cursor.
:r !{cmd} execute {cmd} and insert its standard output below the cursor.