贪吃蛇代码100行c/c++
贪吃蛇 基础知识 :结构体、数组 、srand()随机函数 以及#include <conio.h> 头文件下面的控制台输入 简单易懂没什么难的内容 运行环境 VScode2019 dev好像运行的更稳定 晕 、 代码这么短值得说的是 运用了 head 和tail 吧 ,呃好像队列 (自己也不知道为啥想起来用这个) 贪吃蛇吃掉食物后tail就减减, 然后变为蛇的长度就增加啦 没吃的话一直走蛇身体的长度不变(害 我擦 自己也不会解释了 。。。 代码说话吧) 人狠话不多 代码: 在这里插入代码片 ```#include < stdio . h > # include <stdlib.h> # include <stdio.h> // 随机函数的头文件 # include <iostream> //输入输出流吧 c也可以 cout 换成printf 就好了 # include <conio.h> # include <ctime> using namespace std ; char s [ 1000 ] [ 1000 ] ; int N = 28 , M = 80 , direction = 75 , k = 77 , grade = 0 ; int head = 4 , tail = 1 , leng , x , y , z = 1000 , game = 1 ; struct