Basic Shapes in Graphics.h
1. Line (x0,y0,x1,y1)
2. Rectangle(left,top,right,bottom)
3. Circle(x0,y0,radius)
4. Ellipse(x0,y0,startangle,endangle,xaxis,yaxis)
Sourcecode:
#include<graphics.h> using namespace std; int main() { int gd=DETECT, gm; initgraph(&gd, &gm,NULL); outtextxy(150,15, "Some Basic Shapes in Graphics.h"); line(10,50,500,50); outtextxy(501,60,"Line"); circle(150,150,50); outtextxy(201,201, "Circle"); rectangle(350,100,500,200); outtextxy(505, 211, "Rectangle"); ellipse(300, 300,0,360, 100,50); outtextxy(440, 330, "Ellipse"); getch(); closegraph(); return 0; }Output:
nn@linuxmint ~ $ g++ g1.cpp -lgraph g1.cpp: In function ‘int main()’: g1.cpp:12: warning: deprecated conversion from string constant to ‘char*’ g1.cpp:15: warning: deprecated conversion from string constant to ‘char*’ g1.cpp:18: warning: deprecated conversion from string constant to ‘char*’ g1.cpp:21: warning: deprecated conversion from string constant to ‘char*’ g1.cpp:24: warning: deprecated conversion from string constant to ‘char*’ nn@linuxmint ~ $ ./a.out XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0" after 121 requests (117 known processed) with 0 events remaining. nn@linuxmint ~ $
hy !
ReplyDeleteany chance to escape from warning: deprecated conversion from string . . . ??
name of shapes
ReplyDelete