#include #include #include using namespace std; const int WIDTH = 100; const int HEIGHT = 50; char map[HEIGHT][WIDTH]; void generateMap() { srand(time(0)); for (int i = 0; i < HEIGHT; i++) { for (int j = 0; j < WIDTH; j++) { if (i > HEIGHT / 2) map[i][j] = '#'; // 地面 else map[i][j] = ' '; // 空气 } } } void printMap() { for (int i = 0; i < HEIGHT; i++) { for (int j = 0; j < WIDTH; j++) { cout << map[i][j]; } cout << endl; } }