Output won't move across the screen

My output of "RIGHT" and "LEFT" won't move across the screen like I want and I have no idea what could be wrong. Can anyone help??

Thanks!

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <windows.h>

using namespace std;

void placeCursor(HANDLE, int, int);
void displayWords(HANDLE);
//bool iskeypressed(unsigned);

int main(void)
{
	HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE);
		
	displayWords(screen);
	
	Sleep(5000);
	
	return 0;
}

/******************************************************
*                     placeCursor                     *
******************************************************/
void placeCursor(HANDLE screen, int row, int col)
{ 						// COORD is a defined C++ structure that
	COORD position; 	// holds a pair of X and Y coordinates
	position.Y = row;
	position.X = col;
	SetConsoleCursorPosition(screen, position);
}

void displayWords(HANDLE screen)
{
	int count = 0;
	int index = 76;
	
	do
	{
		placeCursor(screen, 8, count);
		cout << "RIGHT" << endl;
		placeCursor(screen, 15, index);
		cout << "LEFT" << endl;
		count++;
		index--;
		Sleep(500);
	} while (count > 15 || index < 70);
}
while (count > 15 || index < 70)

This statement is false right away.
Topic archived. No new replies allowed.