Answers for "map defualt value c++"

C++
1

map defualt value c++

// C++ program to illustrate a Map
// initialize with default value
#include <bits/stdc++.h>
using namespace std;
  
// Structure Node
struct Node {
    int value = -1;
};
  
// Driver Code
int main()
{
    // Map initialize with key value
    // pair with each pair mapped with
    // structure Node
    map<int, Node> Map;
  
    // Print the default value of 1
    // store in Map
    cout << Map[1].value << endl;
  
    return 0;
}
Posted by: Guest on March-22-2022

Browse Popular Code Answers by Language