Saturday, May 9, 2020

c prog on line


C program to display different types of lines


#include <graphics.h>
#include <conio.h>

int main()
{
//initializing graphic driver and
//graphic mode variable
int graphicdriver=DETECT,graphicmode;

//calling initgraph
initgraph(&graphicdriver,&graphicmode,"c:\\turboc3\\bgi");

//Printing message for user
outtextxy(20, 20 + 20, "Program to set different styles of lines in C graphics");

//initilizing the variables
int c , x = 120, y = 80;

//for loop to set different styles of line
for ( c = 4 ; c >= 0 ; c-- )
{
setlinestyle(c, 0, 3);
line(x, y, x+150, y);
y = y + 20;
}

getch();

return 0;
}

No comments:

Post a Comment