Skip to content

Instantly share code, notes, and snippets.

@elexfreeman
Created July 20, 2020 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elexfreeman/ee7d6a06d756eca024a59871c0388fd4 to your computer and use it in GitHub Desktop.
Save elexfreeman/ee7d6a06d756eca024a59871c0388fd4 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <windows.h>
void fFeel(int aMatrix[20][20])
{
for (int x = 0; x < 20; x++)
{
for (int y = 0; y < 20; y++)
{
aMatrix[x][y] = 0;
}
}
}
void fPrint(int aMatrix[20][20])
{
//std::system("CLS");
for (int x = 0; x < 20; x++)
{
for (int y = 0; y < 20; y++)
{
std::cout << aMatrix[x][y] << " ";
}
std::cout << "\r\n";
}
}
void fPoint(int dx, int dy, int aMatrix[20][20])
{
int k = 0;
int val = 0;
aMatrix[dx][dy] = 9;
for (int x = 0; x < 20; x++)
{
for (int y = 0; y < 20; y++)
{
if (!((dx == x) && (dy == y)))
{
aMatrix[x][y] = floor( 9 - std::sqrt(((dx - x) * (dx - x)) + ((dy - y) * (dy - y))));
if (aMatrix[x][y] < 0) { aMatrix[x][y] = 0; }
}
}
}
}
int main() {
int aMatrix[20][20] = {};
fFeel(aMatrix);
fPoint(4, 6, aMatrix);
fPrint(aMatrix);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment