জয়েন লগইন

সি++ nested

🌈সি++ nested কি?

📋সি++ nested হলো নেস্টেড স্ট্রাকচার তৈরি করার পদ্ধতি।

⚒️সি++ nested নেস্টেড স্ট্রাকচার তৈরি করতে ব্যবহৃত হয়।

সি++ nested নেস্টেড স্ট্রাকচার তৈরি করার উদাহরণ।

cpp
#include <iostream>
using namespace std;

int main() {
std::map<std::string, std::variant<
  std::string,
  std::map<std::string, std::string>
>> user = {
  {"নাম", "মোঃ আরিফ"},
  {"তথ্য", {
    {"স্বপ্ন", "সফটওয়্যার ইঞ্জিনিয়ার"},
    {"দেশ", "বাংলাদেশ"}
  }}
};

for (const auto& [key, value] : user) {
  std::cout << key << ": " << value << std::endl;
}
}