Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ map value int to string

stoi function turns string values to int

player.insert(std::pair<std::string, std::string>("attack", "16"));
player.insert(std::pair<std::string, std::string>("health", "100"));
    
int player_health = stoi(player["health"]);
int player_attack = stoi(player["attack"]);
 
PREVIOUS NEXT
Tagged: #map #int #string
ADD COMMENT
Topic
Name
2+3 =