Friday, November 21, 2014

C Graphics function pro



C Program to Draw Eclipse in C using Graphics Function


#include
#include
#include
 void main()
{
    int gd = DETECT, gm;
    initgraph(&gd, &gm, "C:\\TC\\BGI");
    ellipse(100, 100, 0, 360, 50, 25);
    getch();
    closegraph();
    return 0;
}

C Program to Draw NPN Transistor using Graphics Function


#include
#include
#include
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();
}

C Program to Draw Capacitor using Graphics Function


#include
#include
#include
void main()
{
   int gd = DETECT, gm;
   initgraph(&gd, &gm, "c:\\tc\\bgi");
   outtextxy(110, 60, "C");
   line(80, 100, 100, 100);
   line(100, 80, 100, 120);
   line(120, 80, 120, 120);
   line(120, 100, 140, 100);
   getch();
   closegraph();
}

Write a C Program to Draw A Triangle


#include
#include
#include
void main()
{
   int gd = DETECT, gm;
   initgraph(&gd, &gm, "c:\\tc\\bgi");
   line(300, 100, 200, 200);
   line(300, 100, 400, 200);
   line(200, 200, 400, 200);
   getch();
   closegraph();
}

First Turbo Graphics Program in C Language

#include
#include
void main()
{
    int gd = DETECT, gm;
    initgraph(&gd, &gm, "c:\\tc\\bgi");
    circle(300, 300, 50);
    getch();
    closegraph();
}

Printing Text in Graphics Using Outtextxy Function

#include
#include
#include
int main(void)
{
   int gdriver = DETECT, gmode;
   int x = 200, y = 200;
   initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
   outtextxy(x, y, "Hello World");
   closegraph();
}

Draw Op-amp in C Programming Using Graphics Function

#include
#include
#include
 void main()
{
    int gd = DETECT, gm;
    initgraph(&gd, &gm, "c:\\tc\\bgi");
    line(50, 125, 100, 125);  
    line(50, 175, 100, 175);  
    line(100, 100, 100, 200);  
    line(100, 100, 150, 150);  
    line(150, 150, 100, 200);  
    line(125, 100, 125, 125);  
    line(125, 175, 125, 200);  
    line(150, 150, 200, 150);  
    getch();
    closegraph();
}

C Program to display mouse pointer in textmode

#include
#include
#include
int initmouse();
void showmouseptr();
union REGS i, o; 
int main()
{
   int status;
   status = initmouse();
   if (status == 0)
     {
      printf("Mouse support not available.n");
      }
     else
     {
      showmouseptr();
      }
      return 0;
      }
   int initmouse()
  {
   i.x.ax = 0;
   int86(0X33, &i, &o);
   return (o.x.ax);
}
void showmouseptr()
{
   i.x.ax = 1;
   int86(0X33, &i, &o);
}

Output

It will display Mouse Pointer

No comments:

Post a Comment