VC下的光标移动函数

来源:互联网 发布:淘宝代购服务点 微信 编辑:程序博客网 时间:2024/06/11 01:41

 TC的库函数gotoxy(int x,inty);包含在#include<system.h>

不过在vc下也可以自己写gotoxy(int x,int y)函数

例如:

#include<windows.h>
#include<stdio.h>
void gotoxy(int x,int y)
{
int xx=0x0b;
HANDLE hOutput;
COORD loc;
loc.X= x;
loc.Y=y;
hOutput= GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOutput, loc);return;
}
void main()
{
 gotoxy(1,120);
 printf("000");
}

 

 

额。。。精简版的VC用不了!!!!

当然,也可以在dev-c++下运行。。。

原创粉丝点击