You are viewing a single comment's thread. Return to all comments →
map<string,int> studentMarks; int n,query,marks; cin >> n; string name; for(int i=0; i<n; ++i){ cin >> query; if(query == 1){ cin >> name >> marks; studentMarks[name] += marks; } else if(query == 2){ cin >> name; studentMarks.erase(name); } else if(query == 3){ cin >> name; if(studentMarks.find(name) != studentMarks.end()){ cout << studentMarks[name]; } else{ cout << 0; } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Maps-STL
You are viewing a single comment's thread. Return to all comments →