Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Ankita Belwal/CG
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added Ankita Belwal/output 1.1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Ankita Belwal/output 1.2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Ankita Belwal/output 3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions Ankita Belwal/question 1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <stdio.h>
#include<math.h>
#include <graphics.h>

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;
}
29 changes: 29 additions & 0 deletions Ankita Belwal/question 3.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include<graphics.h>
#include<math.h>
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();
}