大数据最新EasyPlane小游戏,C语言初学者练习项目,大数据开发面试问题和答案

img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上大数据知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

需要这份系统化资料的朋友,可以戳这里获取

EasyPlane小游戏,C语言初学者练习项目

前言

对于C语言初学者来说,练习一些小项目来检验自己的学习成果还是很有必要的,今天我就为大家带来了一个简单小游戏----EasyPlane,适合初学者来学习。

正文

#define \_CRT\_SECURE\_NO\_WARNINGS 1
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>

void target(int target_x, int target_y)//生成目标
{
	int i = 0;
	for (i = 1; i < target_y; i++)
		printf("\n");
	for (i = 1; i < target_x; i++)
		printf("%c", 32);
	printf("+\n");
}
void plane(int plane_x, int plane_y, int isfire)//生成飞机
{
	int i = 0;
	int j = 0;
	for (i = 1; i < plane_y - 2; i++)
		printf("\n");
	if (isfire)//如果开火,显示竖线
	{
		for (j = 1; j < plane_x; j++)
			putchar(32);
		putchar('|');
	}
	printf("\n");
	for (j = 1; j < plane_x; j++)
		putchar(32);
	putchar('\*');
	printf("\n");
	for (j = 1; j < plane_x - 2; j++)
		putchar(32);
	printf("\*\*\*\*\*\n");
	for (j = 1; j < plane_x - 1; j++)
		putchar(32);
	printf("\* \*\n");
}
void game()//游戏主程序
{
	int i = 0;
	int isfire = 0;
	int score = 0;//接收分数
	int plane_x = 10;//飞机横坐标
	int plane_y = 10;//飞机纵坐标
	int target_x = 3;//目标横坐标
	int target_y = 3;//目标纵坐标
	int x = 0;
	int y = 0;
	srand((unsigned int)time(NULL));
	target_x = rand() % 100 + 2;
	target_y = rand() % (plane_y - 5) + 1;
	target(target_x, target_y);
	plane(plane_x, plane_y - target_y + 1, isfire);
	while (1)
	{
		system("cls");
		target(target_x, target_y);
		plane(plane_x, plane_y, isfire);
		for (i = 0; i < 20 - plane_y; i++)
			printf("\n");
		for (i = 0; i < 99; i++)
			putchar(32);
		printf("score: %d\n", score);
		isfire = 0;
		char key = \_getch();
		switch (key)//判断按键信息
		{
		case 'w':
		case 'W':
			plane_y--; break;
		case 's':
		case 'S':
			plane_y++; break;
		case 'a':


![img](https://img-blog.csdnimg.cn/img_convert/e3a235a27b2eba3cc0374808f30970bd.png)
![img](https://img-blog.csdnimg.cn/img_convert/2d072e71b053f3708892265883322f98.png)

**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化资料的朋友,可以戳这里获取](https://bbs.csdn.net/forums/4f45ff00ff254613a03fab5e56a57acb)**


**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

ab5e56a57acb)**


**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值