creating large maps cpp
include
include
using namespace std;
int main() {
map
// Access and modify elements in the map
cout << "Bob's score: " << studentScores["Bob"] << endl;
studentScores["Bob"] += 5; // Increase Bob's score by 5
cout << "Bob's updated score: " << studentScores["Bob"] << endl;
// Iterate through the map
for (auto const& pair : studentScores) {
cout << pair.first << ": " << pair.second << endl;
}
// Check if a key exists in the map
if (studentScores.find("David") == studentScores.end()) {
cout << "David's score is not in the map" << endl;
}
return 0;
}