c语言中如何实现随意移动光标输出字符

来源:百度知道 编辑:UC知道 时间:2024/06/20 12:01:42

  1. 函数名:gotoxy
    原型:extern void gotoxy(int x, int y);
    用法:#include <system.h>
    功能:将光标移动到指定位置说明:gotoxy(x,y)将光标移动到指定行y和列x。设置光标到文本屏幕的指定位置,其中参数x,y为文本屏幕的坐标。
    gotoxy(0,0)将光标移动到屏幕左上角

  2. 例程:

    //这个例子将在屏幕中央输出“hello world”
    #include <stdio.h>
    #include <conio.h>
    #include <system.h>
    int main(){
        clrscr();
        gotoxy(35, 12);
        cputs("Hello world");
        getch();
        return 0;
    }

gotoxy(int x,int y)顾名思义,就是让光标goto到xy坐标的位置!O(∩_∩)O~

c语言只是编程基础语言,不支持上述功能。我是高手,我也不会。

可以使用小键盘边上的上下左右键