Joke Collection Website - News headlines - C language problem: DOS cursor positioning! ! ! Wait online! ! !
C language problem: DOS cursor positioning! ! ! Wait online! ! !
But there is no conio.h in VC, so there is no gotoxy (), which only exists in TC and BC.
Here's what others built:
Include & ltwindows.h & gt
# include & ltiostream & gt
Use namespace std
void go toxy(int x,int y ){
Coordinate c;
c.x = x- 1;
c.y = y- 1;
SetConsoleCursorPosition(GetStdHandle(STD _ OUTPUT _ HANDLE),c);
}
int main()
{
Getuosi (20,12);
std::cout<。 & lt "Hello world!" & lt& ltendl
Returns 0;
}
COORD and SetConsoleCursorPosition are defined in wincon.h ~
SetConsoleCursorPosition is used to set the cursor position on the corresponding device. These two parameters are the device handle and the cursor position structure. GetStdHandle is defined on winbase.h and is used to obtain standard input, output and error output handles.
When the parameter is identified as STD_OUTPUT_HANDLE, the standard output handle is obtained.
- Related articles
- Teacher's Day slogan collection
- Where is the fairy bend hill in Xinjiang? Why is it called fairy bend?
- Slogan of rule of law
- Insurance company business slogan slogan ""
- Care for employees and warm-hearted copywriting
- Why does Guoan 95 jersey write ryobi?
- What confusing behaviors have you done for the postgraduate entrance examination?
- Wedding banner slogan daquan woman married domineering banner
- How to put food in the refrigerator
- 2022 Work Safety Law Promotional Poster-2022 World Work Safety Day Promotional Slogan