執行 ❯
建立您
自己的
網站
×
更改方向
更改主題,深色/淺色
前往 Spaces
#include <iostream> #include <map> using namespace std; int main() { // Create a map that will store the name and age of different people map<string, int> people = { {"John", 32}, {"Adele", 45}, {"Bo", 29} }; // Try to access an element that does not exist (throws an exception) cout << people.at("Jenny"); return 0; }
terminate 在丟擲 'std::out_of_range' 例項後被呼叫
錯誤原因:map::at