Answers for "c++ map value int to string"

C++
0

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"]);
Posted by: Guest on March-25-2022

Browse Popular Code Answers by Language