Hi,
I need to move a word arround the screen using the x,y coordinants in the DOS Console. Like for example I wanted to move the word "Hi!" arround the screen using input from the user.
x=1;
y=2;
"Hi!" location = (x,y);
Thanks
Hi,
I need to move a word arround the screen using the x,y coordinants in the DOS Console. Like for example I wanted to move the word "Hi!" arround the screen using input from the user.
x=1;
y=2;
"Hi!" location = (x,y);
Thanks
The function to place the cursor at a specific location is called 'gotoxy( x,y )' for other compilers. For MS VC you have to look in the FAQ to know how to write your own gotoxy.
When you are at the location, just use your favorite output method. printf, cout etc.
hth
-nv
She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."
When in doubt, read the FAQ.
Then ask a smart question.
So like if I wanted to print the word "Hi!" using cout, with x=5 and y=5. Could you give me a simple example.
Thanks
cout<<"Hi!"<<endl;
Please consult the FAQ on how to write the gotoxy function in MSVC.PHP Code:
#include <iostream>
using namespace std;
// Prototype for your own gotoxy function here
int main()
{
gotoxy( 5, 5 );
cout << "Hi";
return 0;
}
// Implementation of your own gotoxy function here
hth
-nv
She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."
When in doubt, read the FAQ.
Then ask a smart question.
#include <windows.h>
#include <conio.h>
void gotoxy(int x, int y)
{
static HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord = {x, y};
SetConsoleCursorPosition(hConsole, coord);
}
Kuplex
"The only thing you can count on is uncertainty."
Must I explain myself futher?