I'm having troubles with a cin statement in my code and need some guidance. I need my code to refresh an array with completely different ASCII characters, then have the user enter a keystroke and have the refresh speed increase by a few hundred miliseconds every time. Now my C++ teacher gave me a code to use (using the windows.h library) but i have no idea how to apply it or if theres an easier way.
void SetCoord(int x, int y)
{
COORD thing = (x,y);
SetConsoleCursorPosition (GetStdHandle ( STD_OUTPUT_HANDLE), thing);
}
that's the code he gave me but i don't know how to apply it to my code. (will post below)
any help would be great! if you have any other questions let me know! this is only the portion of the game that this involves.
void func2()
{
system("cls");
cout << "----------------------------------------------------------------------------" << endl;
cout << "| You have chosen the Moving Menace game. |" << endl;
cout << "| You will be looking for a specific character in this game. |" << endl;
cout << "| When you see the character, enter the key 'G'. |" << endl;
cout << "| Just as a warning the more you find the character, the faster it moves. |" << endl;
cout << "| Are you ready? |" << endl;
cout << "----------------------------------------------------------------------------" << endl;
Sleep(10000);
//It's over 9000!
cout << "3" << endl;
Sleep(1000);
cout << "2" << endl;;
Sleep(1000);
cout << "1" << endl;
Sleep(1000);
system("cls");
cout << "GO!";
Sleep(1000);
system("cls");
// initialize the array
while(1)
{
cout << "Look for this character: '*' \n" << endl;
char cTest;
iSize = 16;
for (int x = 0; x < iSize; x++)
{
for (int y = 0; y < iSize; y++)
{
cTest = char(rand() % 223 + 33);
cArray[x][y] = cTest;
}
}
// display everything in array
for (int x = 0; x < iSize; x++)
{
for (int y = 0; y < iSize; y++)
{
cTest = cArray[x][y];
cout<< cTest;
}
cout << endl;
}
/*my problems start here! well maybe earlier...*/
Sleep(1500);
system("cls");
}
}