Hello, I'm having troubles figuring out how to make my program display only sertain parts of a file. Here's what I mean:
The file I lead is this:
So, what I need to do is load the the file but display only the first part of it between the % and the # symbol. I can't think of a way to do it, any ideas will be appreciated.
[LET]variable = value
The asignment operator assigns the variable its left the value of the express
ion on its right. The equal sign symbol is used both for assignment, and cond
itional equivalence operator. To avoid confusion the optional LET keyword may
blah blah this is another text
to explain the first line of code, it's what tells the program the size of the file.
Here is the code I use for loading and dysplaying the file:
Thanks in advance.
int LoadMap(char mapFile)
char * sizestr = new char;
string strsize = sizestr;
MAPHEIGHT = atoi(strsize.substr(0,strsize.find("x")).c_str());
MAPWIDTH = atoi(strsize.c_str());
int ycounter = 0;
while(ycounter < MAPHEIGHT)
void DrawMap(int mapheight, int mapwidth)
for(int ycounter = 0; ycounter < mapheight; ycounter++)
for(int xcounter = 0; xcounter < mapwidth; xcounter++)
if(map[ycounter][xcounter] == '#')
cout << map[ycounter][xcounter];