// 显示鼠标 

#include < stdio.h > 
#include < dos.h > 
#include < conio.h > 
int main() {
    union REGS ri,
    ro;
    clrscr();
    ri.x.ax = 0x0;
    int86(0x33, &ri, &ro);
    if (ro.x.ax > 0) {
        printf("\n\nYou have %d button(s) on the mouse on this PC", ro.x.bx);
        ri.x.ax = 0x01;
        int86(0x33, &ri, &ro);
        getch();
    } else printf("This PC has no mouse\n");
    return 0;
}


#include < graphics.h > 
#include < stdio.h > 
#include < math.h > 
#include < stdlib.h > 
#include < conio.h > 
void pingyi(int num, int * points, int dx, int dy);
void bili(int num, int * points, float sx, float sy);
void xuanzhuan(int num, int * points, float jiao);
int main() {
    int num,
    *points;
    int dx,
    dy;
    float sx,
    sy;
    float jiao;
    int x0,
    y0;
    int driver = DETECT,
    mode;
    int bianhuan;
    int i;
    printf("Input dingdian geshu:");
    scanf("%d", &num);
    num++;
    points = (int * ) malloc(2 * num * sizeof(int));
    for (i = 0; i < 2 * (num - 1); i += 2) {
        printf("Input x%d,y%d:", i / 2 + 1, i / 2 + 1);
        scanf("%d,%d", points + i, points + i + 1);
    }
    points[2 * num - 2] = points[0];
    points[2 * num - 1] = points[1];
    clrscr();
    initgraph( & driver, &mode, "C:\\tc20");
    cleardevice();
    setbkcolor(GREEN);
    setcolor(RED);
    drawpoly(num, points);
    printf("Input bianhuan:\n");
    printf("0(pingyi);1(bili);2(xuanzhuan)");
    gotoxy(17, 1);
    scanf("%d", &bianhuan);
    gotoxy(1, 3);
    if (bianhuan == 0) {
        printf("Input dx,dy:");
        scanf("%d,%d", &dx, &dy);
        setcolor(GREEN);
        drawpoly(num, points);
        pingyi(num, points, dx, dy);
    } else if (bianhuan == 1 || bianhuan == 2) {
        printf("Input xiangdui dian x0,y0:");
        scanf("%d,%d", &x0, &y0);
        if (bianhuan == 1) {
            printf("Input bili sx,sy:");
            scanf("%f,%f", &sx, &sy);
            setcolor(GREEN);
            drawpoly(num, points);
            if (x0 == 0 && y0 == 0) bili(num, points, sx, sy);
            else {
                pingyi(num, points, -x0, -y0);
                bili(num, points, sx, sy);
                pingyi(num, points, x0, y0);
            }
        } else {
            printf("Input jiao(-360___360):");
            scanf("%f", &jiao);
            setcolor(GREEN);
            drawpoly(num, points);
            if (x0 == 0 && y0 == 0) xuanzhuan(num, points, jiao);
            else {
                pingyi(num, points, -x0, -y0);
                xuanzhuan(num, points, jiao);
                pingyi(num, points, x0, y0);
            }
        }
    }
    setcolor(RED);
    drawpoly(num, points);
    free(points);
    getch();
    closegraph();
    return 0;
}
void pingyi(int num, int * points, int dx, int dy) {
    int i;
    for (i = 0; i < 2 * num; i += 2) {
        points += dx;
        points += dy;
    }
}
void bili(int num, int * points, float sx, float sy) {
    int i;
    for (i = 0; i < 2 * num; i += 2) {
        points = (int)(points * sx + 0.5);
        points = (int)(points * sy + 0.5);
    }
}
void xuanzhuan(int num, int * points, float jiao) {
    float sinj,
    cosj;
    int i;
    int temp;
    jiao = jiao * M_PI / 180;
    sinj = sin(jiao);
    cosj = cos(jiao);
    for (i = 0; i < 2 * num; i += 2) {
        temp = points;
        points = (int)(points * cosj - points * sinj + 0.5);
        points = (int)(temp * sinj + points * cosj + 0.5);
    }
}