What will be printed to the console?
#include <iostream>
#include <map>
int main(void)
    std::map<int, int> dict;
    std::cout << dict.size();
    return 0;
When accessing an element of the map container by key in the case when such a key is missing, it is automatically added with a default value. Based on the example, the value 10 is put in dict[0]. Next, the value 0 will be put in dict[1]. When checking 10 != 0, and the value 100 will be put into dict[2]. As a result, the container will contain 3 elements.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Зареєструйся Зараз
або Підпишись на майбутні тести