Segmentation fault 11 - Not sure how to make a map dynamic memory allocating -
for full code -->, https://dl-web.dropbox.com/get/documents/projectc%2b%2b/pandemic3.cpp?w=aaaes2dzglonv5y-pi9y3im-aqygikfhj_a7qtep7bpqew have been compiling , running code in terminal using g++.
basically storing object country key codes, dial code of country - gives me segmentation fault 11 after printing contents of map.
keziahs-macbook-pro:projectc++ keziahwain$ ./a.out please enter data country.
would file (f), or manually(m)?
f
enter file name, .txt after it
data.txt
would enter data country? (y or n)
n
printing countries stored in map:
dial code: 11, country:
city: finland
population: 1000
birth rate:1
death rate:1
dialling code:11
segmentation fault: 11
i assume/think need dynamically allocate memory either map, or object in map, dont know how write correct syntax. tried changing 'typedef map' 'typedef *map', 'dialcode codes;' 'dialcode *codes = new dialcode' - these cause more errors. help?
Comments
Post a Comment