#include #include #include #define MAX_COLUMN 20 #define MAX_ROW 20 typedef struct { int current_width; int current_height; int column_width[MAX_COLUMN]; int row_height[MAX_ROW]; } TableInfo; void init_table(int width, int height, TableInfo *table) { table->current_width = width; table->current_height = height; for (int i = 0; i < width; i++) { table->column_width[i] = 5; } for (int i = 0; i < height; i++) { table->row_height[i] = 5; } } void drawGUI(int currentSelection) { system("cls"); // 清除控制台屏幕 printf("======== GUI ========\n"); printf("| |\n"); printf("| [ ] [ ] |\n"); printf("| |\n"); printf("=====================\n"); if (currentSelection == 0) { printf(" ^ \n"); // 显示指向第一个方块被选中 } else { printf(" \n"); } if (currentSelection == 1) { printf(" ^ \n"); // 显示指向第二个方块被选中 } else { printf(" \n"); } } int main() { int currentSelection = 0; int keyPressed; while (1) { drawGUI(currentSelection); keyPressed = getch(); // 获取键盘输入 if (keyPressed == 224) { // 特殊键 keyPressed = getch(); // 获取特殊键码 if (keyPressed == 75) { // ←键 currentSelection = (currentSelection - 1) % 2; // 向左选择方块 } else if (keyPressed == 77) { // →键 currentSelection = (currentSelection + 1) % 2; // 向右选择方块 } } } return 0; }