A Simple Program to Draw a Line - - Ubuntu (libgraph) - Graphics & Multimedia Lab

A Simple C++ Program to Draw a Line 
  Ubuntu (libgraph) - Graphics & Multimedia Lab

Program:

//
#include<iostream>
#include<graphics.h>
using namespace std;
int main()
{
 int gd=DETECT,gm,x,y;
 initgraph(&gd,&gm,NULL);
 line(0,0,100,100);
 getch();
 closegraph();
 return 0;
}


Output:

nn@linuxmint ~ $ g++ cg2.cpp -lgraph
nn@linuxmint ~ $ ./a.out


5 comments:

  1. i did the same but error occured at run time undefined symbol line
    undefined symbol closegraph
    undefined symbol initgraph

    ReplyDelete
  2. buhahahaaaaaaaaaaaa................
    sangathi toppaekkanu...

    ReplyDelete
  3. it's case sensetive and remember to type NULL in capitals

    ReplyDelete
  4. int#include
    #include
    using namespace std;
    int main()
    {
    int gd=DETECT,gm,x,y;
    initgraph(&gd,&gm,NULL);
    line(0,0,100,100);
    getch();
    closegraph();
    return 0;
    }

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...