diff --git a/Ankita Belwal/CG b/Ankita Belwal/CG new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Ankita Belwal/CG @@ -0,0 +1 @@ + diff --git a/Ankita Belwal/output 1.1.jpeg b/Ankita Belwal/output 1.1.jpeg new file mode 100644 index 0000000..acbe4d2 Binary files /dev/null and b/Ankita Belwal/output 1.1.jpeg differ diff --git a/Ankita Belwal/output 1.2.jpeg b/Ankita Belwal/output 1.2.jpeg new file mode 100644 index 0000000..e0b3895 Binary files /dev/null and b/Ankita Belwal/output 1.2.jpeg differ diff --git a/Ankita Belwal/output 3.png b/Ankita Belwal/output 3.png new file mode 100644 index 0000000..e3ba9b0 Binary files /dev/null and b/Ankita Belwal/output 3.png differ diff --git a/Ankita Belwal/question 1.c b/Ankita Belwal/question 1.c new file mode 100644 index 0000000..065a311 --- /dev/null +++ b/Ankita Belwal/question 1.c @@ -0,0 +1,32 @@ +#include +#include +#include + +int main(){ + int gd=DETECT, gm; + initgraph(&gd, &gm, ""); + + int gd=DETECT, gm; + initgraph(&gd, &gm, ""); + + int x,y,x1,y1; + x=30, y=30, x1=100, y1=100; + + outtext(" Before translation"); + line(x,y,x1,y1); + + int i = 200; + x += i, + y += i, + x1 += i, + y1 += i; + delay(1000); + cleardevice(); + + outtext(" After translation"); + line(x,y,x1,y1); + + getch(); + closegraph(); + return 0; +} diff --git a/Ankita Belwal/question 3.C b/Ankita Belwal/question 3.C new file mode 100644 index 0000000..8c6a964 --- /dev/null +++ b/Ankita Belwal/question 3.C @@ -0,0 +1,29 @@ +#include +#include +void main(){ + float x,y,x1,x2,y1,y2,dx,dy,steps; + int i,gd=DETECT,gm; + printf("Enter value of x1,y1,x2,y2= "); + scanf("%f%f%f%f",&x1,&y1,&x2,&y2); + initgraph(&gd,&gm,"C:\\TURBOC3\\BGI"); + setbkcolor(WHITE); + dx=abs(x2-x1); + dy=abs(y2-y1); + if(dx>=dy){ + steps=dx; + }else{ + steps=dy; + } + dx=dx/steps; + dy=dy/steps; + x=x1; + y=y1; + i=1; + while(i<=steps){ + putpixel(x,y,5); + x=x+dx; + y=y+dy; + i=i+1; + } + closegraph(); +} \ No newline at end of file