Ahoj
Mám problém při výstup matice vypíše mi to pouze 1.sloupec nevíte někdo kde je chyba?
#include <iostream>
using namespace std;
const int N = 8;
char Grid[N][N];
void Star(const int Row, const int Column)
{
if (0 <= Row && Row < N && 0 <= Column && Column < N)
Grid[Row][Column] = '*';
else
cout << "Row or column is out of valid range!" << endl;
}
void Space(const int Row, const int Column)
{
if (0 <= Row && Row < N && 0 <= Column && Column < N)
Grid[Row][Column] = ' ';
else
cout << "Row or column is out of valid range!" << endl;
}
void FillGrid()
{
for(int i=0; i<N; i++){
for(int j=0; j<N; j++){
if(i%2!=0 || j%2!=0)
Star(i,j);
else {
Space(i,j);
}
}
}
}
void PrintGrid()
{
for(int i = 0; i < N; i++)
{
for(int j = 0; j < N; j++)
{
cout << Grid[i][j];
cout << endl;
cout << endl;
}
}
}
int main()
{
FillGrid();
PrintGrid();
}