C Program to Draw NPN 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,"NPN 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(140,190,150,210);
line(130,210,150,210);
outtextxy(100,250,"NPN Transistor");
getch( );
closegraph( );
}
--------------------------------------------------------------------------------------------------------------------------
Output
--------------------------------------------------------------------------------------------------------------------------
Displays NPN Transistor
EmoticonEmoticon