heeey guys
i want to make predator and pray simulation and i made the 2d array i just don't know what to do next
i need help !!!!:S
#include <iostream>
using namespace std;
void printGrid(char grid[][20], int w, int h);
int main() {
// Create a 20 by 20 grid array of chars
char grid[20][20];
// Now loop through each row...
for (int i = 0; i < 20; i++) {
// ... then each column and set each space to '.'
for (int j = 0; j < 20; j++) {
grid[i][j] = '.';
}
}
// Print the grid of 20 by 20 dots
printGrid(grid,20,20);
return 0;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
std::cin.get();
}
// Call this function to print your grid. w = width, h = height
void printGrid(char grid[][20], int w, int h) {
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
cout << grid[i][j] << " ";
}
cout << endl;
}
}