CG Practical 3
CG Practical 3
RACTCAL
Page No. :
Date :
So s=S+ 4(2-)+lo
Steps Compude emaing symme pnp
Step & plat
Page No. :
Date
Page No. :
Name :- Dhirajkumar Pachling
Div :-A
Roll NO. :-47
Assignment No. 3
CODE:
#include <iostream>
# include <graphics.h>
# include <stdlib.h>
using namespace std;
class dcircle
else
{
d=d+4*(x-y)+10;
y-y-1;
X=x+1;
while(x<y);
}:
class pt
void setcolor(int c)
colorrc;
void draw)
{
putpixel(xco,yco,color);
}
;
class dline:public pt
private: int x2, y2;
public:
dline():pt)
x2-0;
y2-0;
void setline(int x, int y, int Xx, int yy)
pt::setco(x,y);
x2-XX;
y2=yy;
void drawl( int colour)
{
float x,y,dx,dy, length;
int i;
pt:setcolor(colour);
dx= abs(x2-xco);
dy-abs(y2-yco);
if(dx>=dy)
length= dx;
else
{
length= dy;
dx-(x2-xco)/length;
dy-(y2-yco)/length;
X=XCO+0.5:
y=yco+0.5;
i=l;
while(i<=1ength)
pt::setco(x,y);
pt::draw();
X=xtdx;
y-ytdy;
iitl;
pt::setco(x,y);
pt::draw);
int main)
Input:
Value OfX: 100
Value OfY: 70
Value OfR:30
Assqnment AssgnentvECLRS
File Edt Search View
ProjEct Éxecute Tocts AStyle Windew
lWindows BGi Heip
-GCc 4.9.2 32-bit 2aleass
Project
CAUsers AA:signmentAsignmentÄsignment.exe
Rter the value ofy 79
enter the value of radiusi : 39
Enter Iotal Nrsber of linés:
enten togrdinates ofpoint yl 40
Enter co-6rdinates of påint x2 184
chter toord ínates of po int y2 124
Enter oordinates of po int x1 48
Rnte coordinates of point yl 40
Enter c0"0rdinates of po int x 164
enter to0Pd inates of point y2 18
ente co0rdinates of oint yl 44
Enten coordinates of point x 180
eiter cordinates of po int y2 i24
Fntr 0Pdinate of cent re f ircle
DD Com
Compilation results. . .
Abort ioripiatio
- Errors: 0
Waznang9: 0
Shorten compler paths - Output F1lername:
- Output S1ze: 1.36159801483154 M1B
- Comp1lation Tire: 2.00s
Line 200 Cot 1 Set 0 Lines 205 Length 2766 Insert Done parsing in 0.015 seconds