Hello I am looking to read a file into a 2d array to show which spaces have been taken/ haven't taken whiey will show a # if not taken and a T if taken, so far I just have a text file I created which shows like this:
T # # T
T T T #
All I am trying to do at the moment is to read this into a 2d array and display it as above, later on I will allow users to choose a position and take a space of the layout (changing a T to a #) and then I will want to save it to the file to make the changes.
But at the moment all I want to do is show it, this is what I have so far, I appologize if it's messy, I have made so many changes now to try and get it to work.
I hope someone can offer som guideance.
void Layout::layoutset(void)
{
ifstream myFile ("layout.txt", ios::in);
myFile.precision(2);
myFile.setf(ios::fixed, ios::showpoint);
myFile >> spaceLayout[2][5];
while (!myFile.eof())
myFile >> //Don't know what to put here
while (!myFile.eof())
{
for (int r = 0; r<2; r++)
{
for (int c = 0; c < 5; c++)
{
spaceLayout[r][c] = //?Don't know what to put here
}
}
}
myFile.close();
}