Different Line type in Computer graphics in C program

Aim
To draw the different line type in c program C program CS1355-Graphics & Multimedia Lab
Algorithm
Start the program for line type
Include the necessary package
Declare the line type in lname character
Using setline style and line function to draw the different line function
Finally terminate the function
Source code in C program
#include <graphics.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
void main()
{
int gd=DETECT,gm;
int s;
char *lname[]={"SOLID LINE","DOTTED LINE","CENTER LINE",
"DASHED LINE","USERBIT LINE"};
initgraph(&gd,&gm," ");
clrscr();
cleardevice();
printf("Line styles:");
for (s=0;s<5;s++)
{
setlinestyle(s,1,3);
line(100,30+s*50,250,250+s*50);
outtextxy(255,250+s*50,lname[s]);
}
getch();
closegraph();
}
Output

Different Line type in Computer graphics in C program

Related post