Professional Documents
Culture Documents
GotoXY Code
GotoXY Code
h>
#include "conio.h"
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
Sleep(200);
gotoXY(x,y); // Locate the asterisk
cout << " "; // Remove it from screen, so we don't have a trail of asterisks
}
x--; // Remove 1 from x, so we start where the text is now located
Sleep(800);
for (y=23;y>8;y--) // Moves text up the screen to row 8
{
Sleep(200);
gotoXY(x,y);
cout << " ";
Sleep(200);
gotoXY(x,y-1);
cout << "* column " << x << ", row " << y-1 << "!";
}
void WaitKey()
{
while (_kbhit()) _getch(); // Empty the input buffer
_getch(); // Wait for a key
while (_kbhit()) _getch(); // Empty the input buffer (some keys sends two
messages)
}