Skip to content
Snippets Groups Projects
Select Git revision
  • a6a3f30e02f6d6a51148d0ed5ef3afd43d44a3f6
  • master default
  • add-license-1
  • 6.2
  • 6.0
  • 5.3b
  • 5.1
  • 4.12
  • 4.4
  • 4.3
10 results

build.gradle

Blame
  • trans.c 2.05 KiB
    #include<stdio.h>
    #include<conio.h>
    #include<graphics.h>
    #include<math.h>
    
    void translate();
    void scale();
    void rotate();
    
    void main()
    {
    int ch;
    int gd=DETECT,gm;
    initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
    
    setcolor(6);
    outtextxy (100,88,"Object.");
    rectangle(100,150,150,100);
    
    printf("---MENU---");
    printf("\n 1)Translate\n 2)Scale\n 3)Rotate");
    printf("\nEnter your choice: ");
    scanf("%d",&ch);
    cleardevice();
    
    switch(ch)
    {
    case 1: translate();
    break;
    case 2: scale();
    break;
    case 3: rotate();
    break;
    default: printf("you have enterd wrong choice");
    break;
    }
    getch();
    closegraph();
    }
    
    void translate()
    {
    int tx,ty;
    setcolor(2);
    outtextxy(240,10,"TRANSLATION");
    outtextxy(238,20,"------------");
    printf("\nEnter tx: ");
    scanf("%d",&tx);
    printf("\nEnter ty: ");
    scanf("%d",&ty);
    cleardevice();
    rectangle(100,150,150,100);
    printf("\nAfter Translation");
    rectangle(100+tx,150+ty,150+tx,100+ty);
    }
    
    void scale()
    {
    int sx,sy;
    setcolor(2);
    outtextxy(240,10,"SCALING");
    outtextxy(238,20,"--------");
    printf("\nEnter sx: ");
    scanf("%d",&sx);
    printf("\nEnter sy: ");
    scanf("%d",&sy);
    cleardevice();
    rectangle(100,150,150,100);
    printf("\nAfter Scaling");
    rectangle(100*sx,150*sy,150*sx,100*sy);