РЕПЕТИТОР математика физика информатика
Для школьников и студентов. Подтягивание пробелов. ЦЭ, ЦТ, ОГЭ, ЕГЭ.
Идет набор на ЛЕТО. Жмите для подробностей:)
⊗cppTsTmClL3 56 of 131 menu

Задачи на многомерность в C++. Часть 3

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, std::string>> map = { {"user1", {{"name", "Alice"}, {"age", "25"}}}, {"user2", {{"name", "Bob"}, {"age", "30"}}} };

Используя вложенный цикл for, выведите все пары ключ-значение внутренних std::map.

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, std::string>> map = { {"department1", {{"manager", "John"}, {"employees", "10"}}}, {"department2", {{"manager", "Sarah"}, {"employees", "15"}}} };

Используя вложенный цикл for, найдите общее количество сотрудников.

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, std::map<std::string, std::string>>> map = { {"config", { {"database", {{"host", "localhost"}, {"port", "5432"}}}, {"settings", {{"theme", "dark"}, {"language", "en"}}} }} };

Используя вложенный цикл for, найдите все числовые значения.

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, std::map<std::string, int>>> map = { {"productA", { {"stock", {{"warehouse1", 50}, {"warehouse2", 30}}} }}, {"productB", { {"stock", {{"warehouse1", 20}}} }} }; std::map<std::string, int> prices = {{"productA", 100}, {"productB", 200}};

Используя вложенный цикл for, найдите общее количество товаров на складах.

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, std::map<std::string, std::string>>> map = { {"school", { {"class1", {{"students", "25"}, {"teacher", "Mr. Smith"}}}, {"class2", {{"students", "30"}, {"teacher", "Mrs. Johnson"}}} }} };

Используя вложенный цикл for, найдите общее количество студентов.

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, std::map<std::string, int>>> map = { {"level1", {{"a", {{"x", 1}, {"y", 2}}}}}, {"level2", {{"b", {{"z", 3}, {"w", 4}}}}} };

Используя тройной цикл for, найдите сумму всех значений.

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, int>> map = { {"server1", {{"cpu", 80}, {"memory", 60}}}, {"server2", {{"cpu", 0}, {"memory", 10}}} }; std::map<std::string, std::string> status = {{"server1", "online"}, {"server2", "offline"}};

Используя вложенный цикл for, найдите среднюю загрузку CPU.

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, std::map<std::string, std::string>>> map = { {"projectX", {{"team", {{"lead", "Tom"}, {"members", "5"}}}}}, {"projectY", {{"team", {{"lead", "Lisa"}, {"members", "8"}}}}} };

Используя вложенный цикл for, создайте список всех team lead-ов.

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, std::map<std::string, int>>> map = { {"cityA", { {"population", {{"value", 100000}}}, {"area", {{"km2", 50}, {"miles2", 19}}} }}, {"cityB", { {"population", {{"value", 200000}}}, {"area", {{"km2", 80}, {"miles2", 31}}} }} };

Используя вложенный цикл for, найдите общую площадь в km².

Дана многомерная коллекция std::map:

std::map<std::string, std::map<std::string, std::map<std::string, int>>> map = { {"account1", { {"balance", {{"value", 1000}}}, {"transactions", {{"count", 5}, {"amount", 500}}} }}, {"account2", { {"balance", {{"value", 2000}}}, {"transactions", {{"count", 8}, {"amount", 1200}}} }} };

Используя вложенный цикл for, найдите общую сумму всех балансов.

Мы используем cookie для работы сайта, аналитики и персонализации. Обработка данных происходит согласно Политике конфиденциальности.
принять все настроить отклонить