算法与数据结构Java工程师单选难度 3真题改编 · 2023
2709. 代码片段: import java.util.*;
//这里省略部分代码
HashMap props = new HashMap();
props.put("hello", "javaer");
props.put("welcome", "to java contest");
props.put("wish", "you have a good grade");
Set s = props.keySet();
//在这里插入代码
System.out.println(s);
插入哪一个选项里的代码能够使程序对props里的键进行排序并输出。
练习本题 ›
编程语言单选难度 3真题改编 · 2024
2713. 下面 C++ 代码的运行结果为()
#include <iostream>
#include <map>
int main() {
std::map<int, std::string> m = {{1, "one"}, {2, "two"}, {3, "three"}};
auto it = m.find(2);
m.erase(it);
for (const auto& pair : m) {
std::cout << pair.first << ": " << pair.second << " ";
}
std::cout << std::endl;
return 0;
}
练习本题 ›