gpt4 book ai didi

c - 覆盖 printf 语句中的字符以实现 snake

转载 作者:太空宇宙 更新时间:2023-11-04 03:53:11 24 4
gpt4 key购买 nike

嘿,如何覆盖 c 中的字符?就像在 printf 语句中一样。现在我想返回并用空格覆盖@并增加屏幕上的@。我正在尝试实现贪吃蛇游戏。

#include<stdio.h>
#include<conio.h>
main()
{
printf("@");
}

最佳答案

您正在寻找的是 ANSI control characters .发送这些将允许您移动光标。

例如:

printf("%c[%dA", 0x1B, 10); // move cursor 10 lines up

关于c - 覆盖 printf 语句中的字符以实现 snake,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19229423/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com