C Program to Draw PNP Transistor using Graphics Function

C Program to Draw PNP Transistor using Graphics Function.

InitGraph initializes the graphics system by loading a graphics driver from disk then putting the system into graphics mode.

closegraph( ) function switches back the screen from graphics mode to text mode.

outtextxy(x,y,"PNP Transistor");

It is similar to printf statement. Prints text on a screen in Text Mode while outtextxy( ) function prints Text onto screen in Graphics Mode. This function accepts 3 parameters.

X Co-ordinate - Specifies X Co-ordinate.

Y Co-ordinate - Specifies Y Co-ordinate.

Text - String/Text to be printed on the specified Co-ordinates.

--------------------------------------------------------------------------------------------------------------------------

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

void main( )
{
   int gd = DETECT, gm;
   initgraph(&gd, &gm, "c:\\tc\\bgi");
   line(100,100,100,200);
   line(70,150,100,150);
   line(100,125,150,90);
   line(100,175,150,210);
   line(100,175,110,200);
   line(100,175,125,175);
   outtextxy(200,150,"PNP Transistor");
   getch( );
   closegraph( );
}

--------------------------------------------------------------------------------------------------------------------------

Output

--------------------------------------------------------------------------------------------------------------------------

Displays PNP Transistor



EmoticonEmoticon