I am currently looking for a solution for this c# console application function
I tried searching for a method for creating a while loop that can terminate for the co
Here is code based on the post you deleted :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
BattleGrid grid = new BattleGrid();
grid.PrintGrid();
Console.ReadLine();
}
}
public class BattleGrid
{
public List> grid = new List>();
public BattleGrid()
{
for (int row = 0; row < 4; row++)
{
List newRow = new List();
grid.Add(newRow);
for (int col = 0; col < 4; col++)
{
BattleGridCell newCell = new BattleGridCell();
newRow.Add(newCell);
newCell.rowLetter = ((char)((int)'A' + row)).ToString();
newCell.colnumber = col.ToString();
}
}
}
public void PrintGrid()
{
foreach (List row in grid)
{
Console.WriteLine("|" + string.Join("|", row.Select(x => "X" + x.rowLetter + x.colnumber)));
}
}
}
public class BattleGridCell
{
public string rowLetter { get; set; }
public string colnumber { get; set; }
}
}