m0_64849779 2021-12-11 10:00 采纳率: 100%
浏览 19
已结题

uu们帮帮我这个怎么解决呀!(初学者)

img


原来的如下
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#define map_mode "■"
void HideCursor() //隐藏光标
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cci;
GetConsoleCursorInfo(hOut, &cci);
cci.bVisible = FALSE;
SetConsoleCursorInfo(hOut, &cci);
}
void GotoXY(int x, int y) //光标移动到x,y位置
{
COORD pos = { x,y };
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);// 获取标准输出设备句柄
SetConsoleCursorPosition(hOut, pos); //两个参数分别是指定哪个窗体,具体位置
}
void DrawRectangle(int x1, int y1, int x2, int y2)
{
int i;
for (i = x1; i < x2 ; i += 2) {
GotoXY(i, y1);
printf(map_mode);
GotoXY(i, y2);
printf(map_mode);
}
for (i = y1; i < y2 + 1; i++) {
GotoXY(x1, i);
printf(map_mode);
GotoXY(x2, i);
printf(map_mode);
}
}
int main()
{
int x1 = 10, y1 = 1, x2 = x1 + 26 + 2, y2 = y1 + 20;
int i;
char c;
system("mode con cols=50 lines=25");
system("color 0A"); //背景黑色 字体绿色
HideCursor();
DrawRectangle(x1, y1, x2, y2);
GotoXY(x1 + 2, y2 - 1);
printf("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
do{
c = rand() % 26 + 'A';
for (i = y1 + 1; i < y2 - 1; i = i + 1)
{
GotoXY(x1 + c - 'A' + 2, i);
printf("%c", c);
Sleep(100);
GotoXY(x1 + c - 'A' + 2, i);
printf(" ");
}
GotoXY(x1 + c - 'A' + 2, i);
printf("=");
Sleep(200);
GotoXY(x1 + c - 'A' + 2, i);
printf("%c", c);
} while (kbhit() == 0);
return 0;
}

  • 写回答

1条回答 默认 最新

  • bekote 2021-12-11 13:23
    关注

    有个地方SetConsoleCursorPosition里Cursor打成Cersor了,找一下改过来就行

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 12月19日
  • 已采纳回答 12月11日
  • 创建了问题 12月11日

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探