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
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. C++
  3. Introduction
  4. Conditional Statements
  5. Discussions

Conditional Statements

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 707 Discussions, By:

recency

Please Login in order to post a comment

  • iamsurajmandal
    16 hours ago+ 0 comments

    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
  • munna10359
    1 day ago+ 0 comments

    string arr[9] = {"one", "two", "three", "four","five", "six", "seven", "eight", "nine"}; if(n > 9) cout << "Greater than 9" << endl; else cout << arr[n-1] << endl;

    0|
    Permalink
  • rushibho03
    4 days ago+ 0 comments

    include

    using namespace std;

    int main()

    { int a; cin>>a;

    { if(a==1) { cout<<"one"; } else if(a==2) { cout<<"two"; } else if(a==3) { cout<<"three";

    } else if(a==4) { cout<<"four"; } else if(a==5) { cout<<"five";

    } else if(a==6) { cout<<"six"; } else if(a==7) { cout<<"seven"; } else if(a==8) { cout<<"eight";

    } else if(a==9) { cout<<"nine"; }

    else { cout<<"Greater than 9"; } return 0; } }

    -1|
    Permalink
  • ujjainpandit6
    1 week ago+ 0 comments

    Panditg is one of the well-known best pandit for kaal sarp puja in ujjain. He is well-versed in the Vedic rituals and can perform the puja in a professional and sacred manner. He is an experienced priest and has been performing Kaal Sarp Puja in Ujjain for many years. He is also well-versed in the mantras and rituals associated with the puja and ensures that they are properly followed.

    -3|
    Permalink
  • gonestill
    1 week ago+ 0 comments
    void printString(int n){
        std::vector<std::string> stringsVector 
        = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
        std::string outString = "Greater than 9";
        
        if (n <= 9){
            outString = stringsVector[n-1];
        }
        
        std::cout<<outString<<std::endl;
        
        return;
    }
    
    1|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy