Professional Documents
Culture Documents
Roll n0-205B060
PROGRAM
#include<iostream>
#include<graphics.h>
#include<math.h>
using namespace std;
class ddaLine {
public:
void drawLine(int x1, int y1, int x2, int y2);
};
class circle {
public:
void drawCirc(int x, int y, int r);
}
};
void tri::draw() {
ddaLine L;
circle C;
L.drawLine(x[0], y[0], x[1], y[1]);
L.drawLine(x[2], y[2], x[1], y[1]);
L.drawLine(x[0], y[0], x[2], y[2]);
C.drawCirc(x[2], (y[0]+(h / 3)), (h / 3));
C.drawCirc(x[2], (y[0]+(h / 3)), (2 * h / 3));
}
int main() {
int l, x, y;
cout << "Enter Length of Equilateral Triangle: ";
cin>>l;
cout << "\nEnter starting pt.";
cin >> x>>y;
int gd = DETECT, gm;
initgraph(&gd, &gm, NULL);
tri t(x, y, l);
t.draw();
delay(100000);
closegraph();
return 0;
}
OUTPUT:
20
20 20
80 20
50 71
--------------------------------
Process exited after 140.4 seconds with return value 0