basic ex of maps in c++
C++
#include <iostream>
#include <iterator>
#include <map>
using namespace std;
int main()
{
map<int, int> marks;
marks.insert(pair<int, int>(160, 42));
marks.insert(pair<int, int>(161, 30));
marks.insert(pair<int, int>(162, 40));
marks.insert(pair<int, int>(163, 50));
marks.insert(pair<int, int>(164, 31));
marks.insert(pair<int, int>(165, 12));
marks.insert(pair<int, int>(166, 34));
map<int, int>::iterator itr;
cout << "nThe map marks is : n";
cout << "ROLL NO.tMarksn";
for (itr = marks.begin(); itr != marks.end(); ++itr) {
cout << itr->first
<< "t t" << itr->second << 'n';
}
cout << endl;
return 0;
}
Also in C++:
- Title
- transpose matrix eigen c++
- Category
- C++
- Title
- euler's totient function c++
- Category
- C++
- Title
- differentialble programming
- Category
- C++
- Title
- how to format decimal palces in c++
- Category
- C++
- Title
- mkdir c++
- Category
- C++
- Title
- max in c++
- Category
- C++
- Title
- dijkstra c++ geeksforgeeks using set
- Category
- C++
- Title
- never gonna give you up lyrics
- Category
- C++
- Title
- how to have a queue as a parameter in c++
- Category
- C++
- Title
- removing repeated characters in a string c++
- Category
- C++
- Title
- c++ program to input and print text using Dynamic Memory Allocation.loop
- Category
- C++
- Title
- modular exponentiation c++
- Category
- C++
- Title
- calculate factorial
- Category
- C++
- Title
- convert string to stream c++
- Category
- C++
- Title
- min and max heap in cpp
- Category
- C++
- Title
- static variable in c++
- Category
- C++
- Title
- nearest integer rounding in c++
- Category
- C++
- Title
- advanced c++ topics
- Category
- C++
- Title
- how to input multiple lines of a file in c++
- Category
- C++
- Title
- mysqli connect
- Category
- C++
- Title
- check if key exists in map c++
- Category
- C++
- Title
- empty string c++ value
- Category
- C++
- Title
- length of array in cpp
- Category
- C++
- Title
- how to initialize a vector in c++
- Category
- C++
- Title
- get data from terminal c++
- Category
- C++
- Title
- create copy of range of string c++
- Category
- C++
- Title
- fill c++
- Category
- C++
- Title
- All palindromic substrings
- Category
- C++
- Title
- c++ show time elapsed
- Category
- C++
- Title
- iterative inorder traversal
- Category
- C++
- Title
- pointers in cpp
- Category
- C++
- Title
- c++ yes no question
- Category
- C++
- Title
- create a 2d array c++
- Category
- C++
- Title
- swapo algorit
- Category
- C++
- Title
- command line options in c++
- Category
- C++
- Title
- c++ remove space from string
- Category
- C++
- Title
- cut by delimiter c++
- Category
- C++
- Title
- mkdir boost filesystem
- Category
- C++
- Title
- loop through array c++
- Category
- C++
- Title
- how to find the mode of a vector c++
- Category
- C++
- Title
- assegnare valori in c++
- Category
- C++
- Title
- class is replace by structure
- Category
- C++
- Title
- how to print eachh chars in string data type in c++
- Category
- C++
- Title
- compile c++ program
- Category
- C++
- Title
- Arrays hackerrank solution in c++
- Category
- C++
- Title
- count a character in a string c++
- Category
- C++
- Title
- constant variables in c++
- Category
- C++
- Title
- create a dictionary cpp
- Category
- C++
- Title
- how to make a switch case statement in c++
- Category
- C++
- Title
- ue4 modular character
- Category
- C++
- Title
- shuffle vector c++
- Category
- C++
- Title
- floor() in c++
- Category
- C++
- Title
- pionter in c++
- Category
- C++
- Title
- pop from between string c++
- Category
- C++
- Title
- preorder traversal c++
- Category
- C++
- Title
- calling by reference c++
- Category
- C++
- Title
- map arduino
- Category
- C++
- Title
- ue4 c++ struct
- Category
- C++
- Title
- how to check sqrt of number is integer c++
- Category
- C++
- Title
- how to round to nearest whole number unity
- Category
- C++
- Title
- c++ ros publisher
- Category
- C++
- Title
- how do for loops on c++
- Category
- C++
- Title
- c++ remove item from list
- Category
- C++
- Title
- range of long long in c++
- Category
- C++
- Title
- how to type cast quotient of two integers to double with c++
- Category
- C++
- Title
- how to avoid tle in c++
- Category
- C++
- Title
- erase in set
- Category
- C++
- Title
- array search c++
- Category
- C++
- Title
- arrow operator c++
- Category
- C++
- Title
- count function c++
- Category
- C++
- Title
- statement that causes a function to end in c++
- Category
- C++
- Title
- c++ get ascii value of char
- Category
- C++
- Title
- visual studio 2019 read and write text file c++
- Category
- C++
- Title
- accumulate in cpp
- Category
- C++
- Title
- checking an int in c++
- Category
- C++
- Title
- uepic games github
- Category
- C++
- Title
- delete a double pointer c++
- Category
- C++
- Title
- pairs in c++
- Category
- C++
- Title
- C++ int to char*
- Category
- C++
- Title
- what are the different ways to traverse a binary tree
- Category
- C++
- Title
- array 2d to 1d
- Category
- C++
- Title
- how to delete something in an array c++
- Category
- C++
- Title
- Runtime Error: Runtime ErrorAbort signal from abort(3) (SIGABRT)
- Category
- C++
- Title
- c++ string to vector int
- Category
- C++
- Title
- function template
- Category
- C++
- Title
- euler phi gfg
- Category
- C++
- Title
- C++ string format ctime
- Category
- C++
- Title
- find all the palindrome substring in a given string
- Category
- C++
- Title
- how to create object in c++
- Category
- C++
- Title
- can we compare a long long int with int in c++ using max or min functions
- Category
- C++
- Title
- sort function in vector c++ stl
- Category
- C++
- Title
- multiset c++
- Category
- C++
- Title
- first fit algorithm
- Category
- C++
- Title
- unsorted array to bst
- Category
- C++
- Title
- array sort c++
- Category
- C++
- Title
- Get handle in C++
- Category
- C++
- Title
- initialize 2d array c++
- Category
- C++
- Title
- array as parameter c++
- Category
- C++
- Title
- c++ constructor
- Category
- C++
- Title
- memset c++
- Category
- C++