资源简介
此小游戏是我在学习C语言时自己编写的,虽然思路简单,但可以很好滴练习我们的编程逻辑,提高我们的学习兴趣。

代码片段和文件信息
#include
#include
#include
#include
#include
int N;
char s[200] = { 0 };
int count;
HWND hwnd;
struct zimu{
int x y;
char i;
char j;
}creat;
void playgame();
void mode();
int main()
{
mode();
system(“cls“);
playgame();
return 0;
}
void mode()
{
int i;
printf(“\t\t\t请选择游戏模式:\n\t\t\t1:简单\n\t\t\t2:普通\n\t\t\t3:苦难\n“);
scanf(“%d“ &i);
switch (i)
{
case 1:N = 12; break;
case 2:N = 8; break;
case 3:N = 3; break;
}
}
void playgame()
{
srand((unsigned int)time(NULL));
initgraph(700 500);
while (1)
{
hwnd = GetHWnd();
creat.i = rand() % 26 + 65;
creat.x = rand() % 590 + 10;
settextstyle(0 10 “微软雅黑“);
setbkmode(NULL);
for (creat.y = 0; creat.y <= 500; creat.y++)
{
Sleep(N);
cleardevice();
settextcolor(WHITE);
outtextxy(creat.x creat.y creat.i);
sprintf(s “得分:%d“ count);
outtextxy(600 20 s);
if (kbhit())
{
creat.j = getch();
if (creat.j == creat.i || creat.j == creat.i + 32)
{
count++;
break;
}
else if (creat.j != creat.i)
{
MessageBox(hwnd “打错了老铁!!!“ “游戏结束!“ MB_OK);
exit(0);
}
}
if (creat.y >=500)
{
MessageBox(hwnd “手速太慢了老铁!!!“ “游戏结束!“ MB_OK);
exit(0);
}
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 193 2018-08-23 22:02 C语言-打字母游戏.txt
文件 1403 2018-04-18 18:29 源.cpp
文件 34816 2018-04-18 13:26 打字系统.exe
----------- --------- ---------- ----- ----
36412 3
相关资源
- Bmp图像处理.zip
- C++ Concurrency in Action 2nd Edition (2019.
- C++ Concurrency in Action中文PDF
- 流程图生成器C语言
- C++ Concurrency in Action- 2nd Edition(英文第
- 简单画图软件c++
- C++ Concurrency in Action (2nd) 无水印
- C++ Concurrency in Action 2nd edition235206
- 基于CY7C68013A的USB2.0详细开发文档
- c++ concurrency in action 2nd edition
- C语言-ATM机模拟系统exe及源码
- Saliency Map opencv C++
- c++ 并发编程实战 中文版+英文版
- 数据结构C语言代码实现
- CY7C68013A新官方资料
- cygnus c++ 2.91.57 for windows
- hotelcy大学餐厅的管理系统源码(附数
- 《C Concurrency in Action》中文版V1.0
- 隋连升主讲+谭浩强《c语言程序设计》
- Cygnus C++ 2.91.57中所有的头文件侯捷,
- 使用C++实现的CYK算法
- 基于单片机的银行排队叫号系统的设
- c语言科学与艺术实训答案
- c语言程序设计题总结资源
- CYK算法的C++实现
- 用c++ 定义一个车(Vehicle)基类,有
- 操作系统抢占式短进程优先调度算法
- C语言链表完整代码
- Concurrency with Modern C++(2019).pdf
- Dependency Walker中文汉化版
评论
共有 条评论