Untitled
Guest 160 19th Sep, 2023
///koordynaty
COORD cord;
int korx[100] = { 0 };
int kory[100] = { 0 };
for (int h = 0; h < 10; h++)
{
//pobieranie wartosci od urzytkownika i konwertowanie tego na x y
int x = 0, y = 0;
bool err = false;
char temp;
cout << "gdzie chcesz gwiazdke: " << endl << "podaj x i y: " << endl;
cin >> temp;
if (temp == 'a')
x = 1;
if (temp == 'b')
x = 2;
if (temp == 'c')
x = 3;
if (temp == 'd')
x = 4;
if (temp == 'e')
x = 5;
//cout << endl << "podaj y: " << endl;
cin >> y;
//sprawdzanie czy mjejsce jest zajete
for (int i = 0; i < 100; i++)
{
for (int j = 0; j < 100; j++)
{
if (korx[i] == x && kory[j] == y)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
//cout << "blad";
err = true;
SetConsoleTextAttribute(hConsole, 4);
}
}
}
//pisanie gwiazdki w tym mjejscu
cord.X = x * 2 + 1;
cord.Y = y * 2 + 1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cord);
cout << "*";
korx[h] = x;
kory[h] = y;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 7);
cord.X = 0;
cord.Y = 13;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cord);
}
cord.X = 0;
cord.Y = 20;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cord);
}
To share this paste please copy this url and send to your friends
RAW Paste Data