0%

  WordPress是一个开源的博客平台,可以很方便的进行博客写作,搭建WordPress首先需要你有一个属于自己的服务器,服务器空间则更加方便(因为不需要自己安装各种前置软件),当然还是推荐买一个阿里云或腾讯云的学生机服务器。

阅读全文 »

C++编写的Clocl GUI

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <graphics.h>
#include <cstdio>
#include <math.h>
#include <time.h>
int posx = 240, posy = 240, R = 170;
char str[24];
int point(int r, int rad, bool xy)//获取偏移点坐标
{
double x = posx, y = posy;
if (xy)return (int)(y - r * cos(rad* PI / 180));
return (int)(x + r * sin(rad* PI / 180));
}
void loop()//更新
{
setbkcolor(EGERGB(30, 30, 30));
setlinewidth(3); setcolor(EGERGB(64, 0, 128));
circle(posx, posy, R + 16); circle(posx, posy, R + 14); circle(posx, posy, R + 12); circle(posx, posy, R + 10);
setlinewidth(1); setcolor(EGERGB(128, 128, 128));
for (int i = 0; i < 60; i++)//刻度
{
if (i % 5)line(point(R + 2, i * 6, 0), point(R + 2, i * 6, 1), point(R + 9, i * 6, 0), point(R + 9, i * 6, 1));
else line(point(R - 4, i * 6, 0), point(R - 4, i * 6, 1), point(R + 9, i * 6, 0), point(R + 9, i * 6, 1));
}
setcolor(EGERGB(0xFF, 0xFF, 0xFF)); setfont(18, 0, "宋体");
for (int i = 1; i <= 12; i++)//读数
{
sprintf(str, "%d", i);
outtextrect(point(R - 8, i * 30, 0) - 5, point(R - 8, i * 30, 1) - 5, point(R - 8, i * 30, 0) + 5, point(R - 8, i * 30, 1) + 5, str);
}
time_t t_now; time(&t_now); tm* t = localtime(&t_now);//获取系统时间
sprintf(str, "%04d/%02d/%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
setlinewidth(8); setcolor(BLUE);
line(posx, posy, point(R - 80, t->tm_hour % 12 * 30, 0), point(R - 80, t->tm_hour % 12 * 30 + t->tm_min / 12, 1));//时针
setlinewidth(4); setcolor(RED);
line(posx, posy, point(R - 40, t->tm_min * 6, 0), point(R - 40, t->tm_min * 6, 1));//分针
setlinewidth(2); setcolor(YELLOW);
line(posx, posy, point(R - 10, t->tm_sec * 6, 0), point(R - 10, t->tm_sec * 6, 1));//秒针
setfillcolor(YELLOW); fillellipse(posx, posy, 5, 5);
setcolor(GREEN); setfont(30, 0, "宋体"); outtextxy(95, 500, str);//数字时钟
}
int main()
{
initgraph(480, 640);//初始化画布
for (; !kbhit(); delay_fps(60))
{
cleardevice();//清除画布
loop();//更新
}
closegraph();//关闭画布
return 0;
}

标准键盘

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
* ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐
* │Esc│ │ F1│ F2│ F3│ F4│ │ F5│ F6│ F7│ F8│ │ F9│F10│F11│F12│ │P/S│S L│P/B│ ┌┐ ┌┐ ┌┐
* └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ └┘ └┘ └┘
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ ┌───┬───┬───┬───┐
* │~ `│! 1│@ 2│# 3│$ 4│% 5│^ 6│& 7│* 8│( 9│) 0│_ -│+ =│ BacSp │ │Ins│Hom│PUp│ │N L│ / │ * │ - │
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ ├───┼───┼───┼───┤
* │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │{ [│} ]│ | \ │ │Del│End│PDn│ │ 7 │ 8 │ 9 │ │
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ ├───┼───┼───┤ + │
* │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │: ;│" '│ Enter │ │ 4 │ 5 │ 6 │ │
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ ├───┼───┼───┼───┤
* │ Shift │ Z │ X │ C │ V │ B │ N │ M │< ,│> .│? /│ Shift │ │ ↑ │ │ 1 │ 2 │ 3 │ │
* ├─────┬──┴─┬─┴──┬┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ ├───┴───┼───┤ E││
* │ Ctrl│ │Alt │ Space │ Alt│ │ │Ctrl│ │ ← │ ↓ │ → │ │ 0 │ . │←─┘│
* └─────┴────┴────┴───────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ └───────┴───┴───┘
*/
阅读全文 »

Python作业,用turtle绘制校庆宣传画。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import turtle


def draw_line(angle, length):
turtle.pendown()
turtle.seth(angle)
turtle.forward(length)


def locate(x, y, extend=None):
startx, starty = -100, 200
if extend:
extend.penup()
extend.goto(startx + x, starty - y)
extend.pendown()
else:
turtle.penup()
turtle.goto(startx + x, starty - y)
turtle.pendown()


def draw_xq():
turtle.pencolor('white')
turtle.pensize(1)
turtle.penup()
locate(96, 1)
draw_line(270, 15)
locate(120, 28)
turtle.fillcolor('white')
turtle.begin_fill()
turtle.seth(120)
turtle.circle(27, 120)
draw_line(180, 53)
draw_line(270, 155)
draw_line(0, 150)
draw_line(90, 155)
draw_line(180, 53)
turtle.end_fill()
locate(10, 53)
turtle.pensize(6)
turtle.pencolor('red')
draw_line(0, 170)
locate(20, 82)
turtle.pensize(8)
draw_line(0, 30)
locate(170, 82)
draw_line(180, 30)
locate(96, 185)
turtle.pensize(50)
draw_line(90, 70)
turtle.pensize(12)
turtle.pencolor('white')
locate(60, 125)
draw_line(0, 70)
locate(60, 178)
draw_line(0, 70)
turtle.pensize(1)
locate(10, 188)
turtle.begin_fill()
draw_line(270, 18)
draw_line(240, 24)
draw_line(0, 56)
draw_line(240, 9)
draw_line(0, 88)
draw_line(120, 9)
draw_line(0, 56)
draw_line(120, 24)
draw_line(90, 18)
draw_line(180, 169)
turtle.end_fill()
turtle.pensize(4)
turtle.pencolor('red')
locate(8, 208)
draw_line(0, 58)
draw_line(60, 9)
draw_line(0, 53)
draw_line(300, 9)
draw_line(0, 58)
turtle.hideturtle()
font = turtle.Turtle()
locate(43, 265, font)
font.pencolor('white')
font.write('1909-2019', font=('Aria', 16, 'bold'))
font.hideturtle()


def draw_word():
font = turtle.Turtle()
locate(-186, 350, font)
font.pencolor('white')
font.write('河南理工大学建校110周年', font=('Aria', 36, 'bold'))
locate(-180, 380, font)
font.write('HENAN POLYTECHNIC UNIVERSITY 110TH ANNIVERSARY', font=('Aria', 16, 'bold'))
font.color(200/255, 166/255, 92/255)
locate(300, 100, font)
font.write('好学力行', font=('楷体', 24, 'bold'))
locate(-250, 200, font)
font.write('明德任责', font=('楷体', 24, 'bold'))
font.hideturtle()


def main():
width, height = 800, 600
turtle.screensize(bg='red')
turtle.setup(width, height, 400, 100)
turtle.speed(10)
draw_xq()
draw_word()
turtle.hideturtle()
turtle.done()


if __name__ == '__main__':
main()

效果如下: