We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. C++
  3. Introduction
  4. Conditional Statements
  5. Discussions

Conditional Statements

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • iamsurajmandal
    2 months ago+ 1 comment

    using map in c++

       map <int, string> m = {{1, "one"}, {2, "two"},
        {3, "three"},
        {4, "four"},
        {5, "five"},
        {6, "six"},
        {7, "seven"},
        {8, "eight"},
        {9, "nine"},
         };
         // creating iterator 
        map < int, string> :: iterator itr;
        itr = m.find(n);
       if(itr != m.end()){
               cout << itr -> second;
        }
        else { cout << "Greater than 9";}
    
    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy