cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Inputting string values to a nested map
Inputting string values to a nested map
Nov 23, 2015 at 8:56am UTC
BrickDos
(1)
Hi, guys! I'm relatively new to c++ so please don't judge me. I'm a bit lost in trying to figure out how to input different parts of a line into different parts of a nested map. as shown below:
map<string, map<string,double> >areayear;
void processFields(string line){
stringstream ss(line);
string country;
while(getline(ss, country, ',')){
cout << country << '\n';
}
I'm able to seperate each part of the string line but I don't know how to input into the map declared above. Each line is formatted like this:
"Country, Year, Value"
Any help would be appreciated!
Nov 23, 2015 at 1:51pm UTC
koothkeeper
(429)
Look at map.insert(). You will be using pair<>.
Topic archived. No new replies allowed.