Is all of that actually in the global scope? Or did you just remove the enclosing functions? If it's the former then you need to do this (the two dimensional array has been fixed too, see below):
Code:
#include <iostream>
#include <cstdlib>
#include <map>
#include <string>
using namespace std;
// Globals //
int x; //x coordinate for map
int y; //y coordinate
string input;
string wall = "Wall.";
map<string, string> rooms;
string maparea[5][5] = {
{"a00","a01","\n","a03","\n"},
{"a10","\n","a12","a13","a14"},
{"a20","a21","\n","\n","a24"},
{"a30","\n","\n","\n","a34"},
{"a40","a41","a42","a43","a44"}
};
int main()
{
rooms["a00"] = "This is the room 0,0\n";
rooms["a01"] = "This is the room 0,1\n";
rooms["a03"] = "This is the room 0,3\n";
rooms["a10"] = "This is the room 1,0\n";
rooms["a12"] = "This is the room 1,2\n";
rooms["a13"] = "This is the room 1,3\n";
rooms["a14"] = "This is the room 1,4\n";
rooms["a20"] = "This is the room 2,0\n";
rooms["a21"] = "This is the room 2,1\n";
rooms["a24"] = "This is the room 2,4\n";
rooms["a30"] = "This is the room 3,0\n";
rooms["a34"] = "This is the room 3,4\n";
rooms["a40"] = "This is the room 4,0\n";
rooms["a41"] = "This is the room 4,1\n";
rooms["a42"] = "This is the room 4,2\n";
rooms["a43"] = "This is the room 4,3\n";
rooms["a44"] = "This is the room 4,4\n";
}
Now for the array:
Code:
string maparea[4][4]{
{"a00","a01",'\n',"a03",'\n'}
{"a10",'\n',"a12","a13","a14"}
{"a20","a21",'\n','\n',"a24"}
{"a30",'\n','\n','\n',"a34"}
{"a40","a41","a42","a43","a44"}
};
The first problem is that you need the assignment operator after the subscripts to tell the compiler this is an initialization. The second is that you say a 4x4 matrix but initialize as a 5x5 matrix, change the dimensions as well:
Code:
string maparea[5][5] = {
Next, string literals and character literals are different. All occurances of '\n' should be "\n" of you will get errors. Lastly, you need commas to separate each dimension:
Code:
{"a00","a01",'\n',"a03",'\n'},
{"a10",'\n',"a12","a13","a14"},
{"a20","a21",'\n','\n',"a24"},
{"a30",'\n','\n','\n',"a34"},
{"a40","a41","a42","a43","a44"}