1鼠标点击哪个圆圈，那个圆圈就转90度，

2指针指向哪个圆圈，哪个圆圈就转90度，

3共有10次机会，每转一圈加90分。

// 十步万度.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 #include<stdio.h>
#include<conio.h> #include<graphics.h> #include<math.h> #define PI 3.14159
struct Round { float x, y; float r; int anglenum; }rounds[5][5]; int step,
score; void startup() { step = 10, score = 0; initgraph(600, 700);
setbkcolor(RGB(50, 50, 50)); setlinestyle(PS_SOLID, 3); cleardevice();
BeginBatchDraw(); int i, j; for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) {
rounds[i][j].r = 30; rounds[i][j].x = 100 + j * 100; rounds[i][j].y = 200 + i *
100; rounds[i][j].anglenum = 1; } } } void show() { cleardevice(); float angle;
int i, j; for (i = 0; i < 5; i++) { for (j = 0; j < 5; j++) {
setlinecolor(RGB(200, 201, 202)); circle(rounds[i][j].x, rounds[i][j].y,
rounds[i][j].r); angle = rounds[i][j].anglenum * PI / 2; setlinecolor(RGB(255,
0, 0)); line(rounds[i][j].x, rounds[i][j].y, rounds[i][j].x + cos(-angle) *
rounds[i][j].r, rounds[i][j].y +sin(-angle) * rounds[i][j].r); } } TCHAR s[20];
setbkmode(TRANSPARENT); _stprintf(s, _T("% d 步 % d 度"), step, score);
settextstyle(50, 0, _T("宋体")); outtextxy(150, 20, s); settextstyle(20, 0,
_T("宋体")); outtextxy(15, 100, _T("点击一个圆圈，其指针顺时针旋转90度后 指向的针依次旋转"));
FlushBatchDraw(); FlushBatchDraw(); } void rotateround(int i, int j) {
rounds[i][j] .anglenum-= 1; if (rounds[i][j].anglenum == -1) {
rounds[i][j].anglenum = 3; } score += 90; } int Getindexes(int indexes[2]) {
int i = indexes[0]; int j = indexes[1]; if (rounds[i][j].anglenum == 1) { i--;
} else if (rounds[i][j].anglenum == 2) { j--; } else if (rounds[i][j].anglenum
== 3) { i++; } else { j++; } indexes[0] = i; indexes[1] = j; if (i >= 0 && i <
5 && j >= 0 && j < 5) { return 1; } else return 0; } void update() { MOUSEMSG
m; if (MouseHit()) { m = GetMouseMsg(); if (m.uMsg == WM_LBUTTONDOWN&&step>0) {
int ci = int(m.y - 150) / 100; int cj = int(m.x - 50) / 100; rotateround(ci,
cj); step--; show(); Sleep(300); int indexes[2] = { ci,cj }; while
(Getindexes(indexes)) { rotateround(indexes[0], indexes[1]); show();
Sleep(300); } } } } int main() { startup(); while (step>0) { show(); update();
} getch(); return 0; }
最开始：

第一步：

最后

GitHub

Gitee