2个回答
推荐于2016-11-17
展开全部
turboc的
#include <stdio.h>
#include <conio.h>
int main()
{
int x, y;
gotoxy(5, 5);
printf("position: 5, 5");
x = wherex();
y = wherey();
getch();
gotoxy(x, y - 1);
getch();
}
控制台的
#include <windows.h>
#include <stdio.h>
#include <conio.h>
void gotoxy(HANDLE hOut, int x, int y);
void getxy(HANDLE hOut, int &x, int &y);
int main()
{
int x, y;
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
gotoxy(hOut, 5, 5);
printf("position: 5, 5");
getxy(hOut, x, y);
getch();
gotoxy(hOut, x, y - 1);
getch();
CloseHandle(hOut);
}
void gotoxy(HANDLE hOut, int x, int y)
{
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(hOut, pos);
}
void getxy(HANDLE hOut, int &x, int &y)
{
CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
GetConsoleScreenBufferInfo(hOut, &screen_buffer_info);
x = screen_buffer_info.dwCursorPosition.X;
y = screen_buffer_info.dwCursorPosition.Y;
}
#include <stdio.h>
#include <conio.h>
int main()
{
int x, y;
gotoxy(5, 5);
printf("position: 5, 5");
x = wherex();
y = wherey();
getch();
gotoxy(x, y - 1);
getch();
}
控制台的
#include <windows.h>
#include <stdio.h>
#include <conio.h>
void gotoxy(HANDLE hOut, int x, int y);
void getxy(HANDLE hOut, int &x, int &y);
int main()
{
int x, y;
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
gotoxy(hOut, 5, 5);
printf("position: 5, 5");
getxy(hOut, x, y);
getch();
gotoxy(hOut, x, y - 1);
getch();
CloseHandle(hOut);
}
void gotoxy(HANDLE hOut, int x, int y)
{
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(hOut, pos);
}
void getxy(HANDLE hOut, int &x, int &y)
{
CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
GetConsoleScreenBufferInfo(hOut, &screen_buffer_info);
x = screen_buffer_info.dwCursorPosition.X;
y = screen_buffer_info.dwCursorPosition.Y;
}
2013-05-07
展开全部
LZ你想学编程的话我建议去饭客网络学习,那里有专门的版块供大家交流学习,还有许多教程供大家观看,你的问题到那里可以解决·
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询