你是否对键盘熟悉?
“qwertyuiopasdfghjklzxcvbnm”是否已经印在你的脑海里?
NO?
没有关系,今天,让我来帮你对键盘有一个更深一步的了解吧!
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
|
#include"stdio.h" #include"stdlib.h" #include"windows.h" #include"conio.h" void entry_place( int num) { for ( int i;i<num;i++) printf ( " " ); } void enter_line( int num) { int i; for (i=0;i<num;i++) { printf ( "\n" ); } } int main() { enter_line(15); entry_place(40); printf ( "press anykey to start" ); getchar (); system ( "cls" ); int levels=0,score=0,lines=0,num=0,col=0; while (1) { system ( "cls" ); for ( int i=0;i<20;i++) { printf ( " " ); } printf ( "levels:%d" ,levels); entry_place(10); printf ( "score:%d" ,score); printf ( "\n" ); entry_place(20); printf ( "1---Pause" ); entry_place(9); printf ( "0---Exit" ); printf ( "\n" ); for ( int i=0;i<80;i++) { printf ( "_" ); } enter_line(1); num= rand ()%26; col= rand ()%80; while (1) { lines++; if (lines>25) { lines=0; score-=10; if (score<-50) { system ( "cls" ); enter_line(15); entry_place(40); printf ( "sorry,you faile!" ); getch(); exit (0); } break ; } entry_place(col); printf ( "%c" , 'a' +num); Sleep(180); printf ( "\b \n" ); if (kbhit()) { char c=getch(); if (c== 'a' +num) { score+=10; break ; } } } } return 0; } |
这样,不论你是什么人,你都会对键盘的了解更深刻。
ok了,今天的内容就是这样,我们下章再见!
更多关于c++实现小游戏的资料请关注服务器之家其它相关文章!
原文链接:https://blog.csdn.net/Wanghs0716/article/details/120750344