问题描述
代码解决
#include <stdio.h>
char a[21][21];//用来存储地图
struct node {
int x;//横坐标
int y;//纵坐标
};
int getnum(int x,int y) {
//
int num=0;//用来计数
int tx, ty;
//从四个方向统计可以消灭的敌人
//向右
tx = x; ty = y;
while (a[tx][ty] != '#') {
//判断是不是墙,不是墙继续
if (a[tx][ty] == 'G') {
num++;
}
ty++;
}
//向左
tx = x; ty = y;
while (a[tx][ty] != '#') {
if (a[tx][ty] == 'G') {