title: Segmentation fault 11 - Not sure how to make a map dynamic memory allocating
body: <p><strong>For full code --></strong>, <a href="https://dl-web.dropbox.com/get/Documents/ProjectC%2B%2B/Pandemic3.cpp?w=AAAEs2dZglONv5y-pI9Y3iM-AqYGIKfHJ_A7qTep7bpqew" rel="nofollow">https://dl-web.dropbox.com/get/Documents/ProjectC%2B%2B/Pandemic3.cpp?w=AAAEs2dZglONv5y-pI9Y3iM-AqYGIKfHJ_A7qTep7bpqew</a>
  I have been compiling and running this code in terminal using g++. </p>
  
  <p>Basically I am storing object Country with key Codes, which is the dial code of the country - it gives me segmentation fault 11 after printing the contents of the map. </p>
  
  <p>Keziahs-MacBook-Pro:ProjectC++ keziahwain$ ./a.out
  Please enter data for a country. </p>
  
  <p>Would you like to do this from a file (f), or manually(m)?</p>
  
  <p>f</p>
  
  <p>Enter file name, with .txt after it</p>
  
  <p>data.txt</p>
  
  <p>Would you like to enter data for another country? (Y or N)</p>
  
  <p>N</p>
  
  <p>Printing countries stored in map:</p>
  
  <p>Dial code: 11, country: </p>
  
  <hr>
  
  <p>City: Finland</p>
  
  <p>Population: 1000</p>
  
  <p>Birth Rate:1</p>
  
  <p>Death Rate:1</p>
  
  <p>Dialling code:11</p>
  
  <hr>
  
  <p>Segmentation fault: 11</p>
  
  <p>I assume/think i need to dynamically allocate memory either for the map, or for the object in the map, but I dont really know how to write the correct syntax. Already tried changing the 'typedef map' to 'typedef *map', the 'dialcode codes;' to 'dialcode *codes = new dialcode' - these just cause more errors. Any help?</p>