-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtool.cpp
More file actions
31 lines (29 loc) · 774 Bytes
/
Copy pathtool.cpp
File metadata and controls
31 lines (29 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* =====================================================================================
*
* Filename: tool.cpp
*
* Description:
*
* Version: 1.0
* Created: 2012/3/31 星期六 16:26:55
* Revision: none
* Compiler: gcc
*
* Author: Python (),
* Company:
*
* =====================================================================================
*/
#include "tool.h"
int random(int a , int b) {
return (rand()%(b-a+1)) + a;
}
void gotoPos(int x,int y) {
HANDLE hOutput; //定义一个句柄
COORD loc; //定义一个结构体,包含坐标X, Y
loc.X = x;
loc.Y = y;
hOutput = GetStdHandle(STD_OUTPUT_HANDLE); //得到标准输出设备的句柄
SetConsoleCursorPosition(hOutput, loc); //设置控制台的光标坐标为loc
}