This code prompts the user asking their name and the school they attend. Storing both into a map(the names into vector). I then want to print out the school and the name of every person that attended that school in this format.
School : name, name , name. /new line School : name, name , name etc. . . .
I first did in java and am trying to convert to c++ not sure if I am doing this correctly, also not sure how to convert the for loop at bottom to c++ (is there something similar to map.keySet() from java in c++ ?)
I keep getting errors for the emplace() is there something that I am doing wrong or need to #include?
int main() {
//Program that takes in users school that they attend and prints out the people that go there
string name;
string school;
//create the map
map<string, vector<string> > sAtt;
do {
    cout << "PLEASE ENTER YOUR NAME: (type \"DONE\" to be done" << endl;
    cin >> name;
    cout << "PLEASE ENTER THE SCHOOL YOU ATTEND:" << endl;
    cin >> school;
    if(sAtt.find(school)) {//if school is already in list
        vector<string> names = sAtt.find(school);
        names.push_back(name);
        sAtt.erase(school); //erase the old key
        sAtt.emplace(school, names); //add key and updated value
    } else { //else school is not already in list so add i
        vector<string> names;
        names.push_back(name);
        sAtt.emplace(school, names);
    }
}while(!(name == "done"));
sAtt.erase("done");
cout << "HERE ARE THE SCHOOLS ATTENDED ALONG WITH WHO GOES THERE: " << endl;
for (string s: sAtt.keySet()) { //this is the java way of doing it not sure how to do for c++
    cout << "\t" << s << sAtt.find(s) << endl;
    //should be School: name, name, name, etc. for each school
}
}
 
     
    