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. Debugging
  4. Overloading Ostream Operator
  5. Discussions

Overloading Ostream Operator

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 57 Discussions, By:

recency

Please Login in order to post a comment

  • abdulrahmannase1
    17 hours ago+ 0 comments
    ostream& operator<<(ostream& out,const Person& pers){
        out<<"first_name="<<pers.get_first_name()<<","<<"last_name="<<pers.get_last_name();
        return out;
    }
    
    0|
    Permalink
  • aadinew7
    2 weeks ago+ 0 comments

    Here are the solution of Overloading Ostream Operator in C++ Hacker Rank Solution

    0|
    Permalink
  • brokenprogramme1
    2 weeks ago+ 0 comments

    Here are the solution of Overloading Ostream Operator in C++ HackerRank Solution https://www.brokenprogrammers.com/overloading-ostream-operator-in-cpp-hackerrank-solution/

    0|
    Permalink
  • poonamdeorasurp1
    1 month ago+ 0 comments

    Here is problem solution - https://thecscience.com/hackerrank-overloading-ostream-operator-in-cpp-problem-solution.html

    0|
    Permalink
  • hilariyus
    2 months ago+ 0 comments

    include

    using namespace std;

    class Person { public: Person(const string& first_name, const string& last_name) : first_name_(first_name), last_name_(last_name) {} const string& get_first_name() const { return first_name_; } const string& get_last_name() const { return last_name_; } private: string first_name_; string last_name_; }; ostream &operator<<(ostream &os,const Person &rhs){ os << "first_name=" << rhs.get_first_name() << ",last_name=" << rhs.get_last_name(); return os; }

    int main() { string first_name, last_name, event; cin >> first_name >> last_name >> event; auto p = Person(first_name, last_name); cout << p << " " << event << endl; return 0; }

    0|
    Permalink
Load more conversations

Need Help?


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