为什么gotoxy()这个函数不能用?

bullet2003 2003-04-09 11:26:55
我为了在屏幕的中间打一行字,写了以下程序。
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
gotoxy(5,6);
cout<<"hi,world"<<endl;
return 0;
}
可是出现错误:
error C2065: 'gotoxy' : undeclared identifier
谁能解释一下为什么?
...全文
1305 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
alexGIS 2003-04-10
  • 打赏
  • 举报
回复
help->index 找gotoxy;
如果找不到,就说明没有。如果找得到,又上角显示的就是你需要包含的头文件。
bullet2003 2003-04-10
  • 打赏
  • 举报
回复
我用的是vc6.0
bullet2003 2003-04-10
  • 打赏
  • 举报
回复
楼上的方法我试了,编译出错
error C2065: 'COORD' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'point'
error C2065: 'point' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'point'
error C2065: 'point' : undeclared identifier
error C2228: left of '.X' must have class/struct/union type
error C2228: left of '.Y' must have class/struct/union type
error C2065: 'SetConsoleCursorPosition' : undeclared identifier
error C2065: 'GetStdHandle' : undeclared identifier
error C2065: 'STD_OUTPUT_HANDLE' : undeclared identifier

用户 昵称 2003-04-10
  • 打赏
  • 举报
回复
//
// Moves the cursor to x, y in console window
// ie x=left\right y=top\bottom
//
void gotoxy(int x, int y)
{
COORD point;
point.X = x; point.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),
point);
}
explorer007 2003-04-10
  • 打赏
  • 举报
回复
什么编译器啊?TC?BC?VC?
andyfr1210 2003-04-09
  • 打赏
  • 举报
回复
在C++的库里没有这个函数。

69,396

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧