Created
July 20, 2020 20:20
-
-
Save elexfreeman/ee7d6a06d756eca024a59871c0388fd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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