C++ PROGRAM TO IMPLEMENT THE CONCEPT OF FIXED SCALING

C++ PROGRAM TO IMPLEMENT THE CONCEPT OF FIXED SCALING

CODE:

#include<stdio.h>

#include<graphics.h>

#include<conio.h>

int main()

{

    int gd=DETECT,gm;

    int x=100,y=100,x1=200,y1=200,x2=300,y2=100,sx=2,sy=1,tx=100,ty=200;

    initgraph(&gd,&gm,"");

    setcolor(YELLOW);

    line(x,y,x1,y1);

    line(x1,y1,x2,y2);

    line(x2,y2,x,y);

    outtextxy(140,210,"BEFORE SCALING");

    setcolor(CYAN);

    line(x*sx+tx*(1-sx),y*sy+ty*(1-sy),x1*sx+tx*(1-sx),y1*sy+ty*(1-sy));

    line(x1*sx+tx*(1-sx),y1*sy+ty*(1-sy),x2*sx+tx*(1-sx),y2*sy+ty*(1-sy));

    line(x2*sx+tx*(1-sx),y2*sy+ty*(1-sy),x*sx+tx*(1-sx),y*sy+ty*(1-sy));

    outtextxy(340,210,"AFTER SCALING");

    getch();

    closegraph();

    return 0;

}


OUTPUT:




Comments

Popular posts from this blog

C++ PROGRAM TO IMPLEMENT THE CONCEPT OF REFLEXION

C++ PROGRAM TO IMPLEMEMT THE CONCEPT OF FLOODFILL ALGORITHM