Translation

#include<graphics.h>

#include<stdio.h>

#include<conio.h>

#include<dos.h>

int main(){

    int gd = DETECT, gm;

    initgraph(&gd, &gm, "C:\\TURBOC3\\BGI");

    int mx = getmaxx();

    int my = getmaxy();

 

    int left = mx / 2 - 100;

    int top = my / 2 - 100;

    int right = mx / 2 + 100;

    int bottom = my / 2;

 

    rectangle(left, top, right, bottom);

 

    printf("Enter translation factors ");

    int a, b;

    scanf("%d%d",&a,&b);

 

    cleardevice();

    rectangle(left + a , top + b, right + a, bottom + b);

 

 

    getch();

    closegraph();

 

    return 0;

}


Previous Post Next Post