Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7398985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:56:49+00:00 2026-05-29T03:56:49+00:00

Since x_str,y_str are local, I am not getting the correct output in this function.

  • 0

Since x_str,y_str are local, I am not getting the correct output in this function. (Illegal chars are printed in the place of x_str and y_str)
I dont want to add 2 more member variables x_str,y_str to my class.

Hence what could be the replacement of this function to get correct output.

string Pos::getPosReport(){
        string x_str;
        x_str = x;
        string y_str;
        y_str = y;
       return string("(" + x_str + "," + y_str + ")" );
    }

EDIT:

class Pos {
    int x;
    int y;
public:
    Pos();
    Pos(Pos const&);
    Pos(int,int);

    Pos&     operator=(Pos const&);
    bool    operator==(Pos const&);
    bool    operator!=(Pos const&);

    void    setPos(Pos const&);
    void    setPos(int,int);

    void    setx(int);
    void    sety(int);

    int    getx() const ;
    int    gety() const ;

    string getPosReport();

    virtual ~Pos();
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T03:56:51+00:00Added an answer on May 29, 2026 at 3:56 am
    std::stringstream ss;
    ss << "(" << x << "," << y << ")";
    return ss; 
    

    (this is the whole function body).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since Rails is not multithreaded (yet), it seems like a threaded web framework would
I have an XOR encypted file by a VB.net program using this function to
I'm not very proficient with AJAX but by all accounts I think this should
My professor wrote this median function and I don't understand it very well. Can
I've recently become interested in writing some system services for OS X but since
We are in the process of creating active-x controls used within our application. Since
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better,
Since CS3 doesn't have a web service component, as previous versions had, is there
Since both a Table Scan and a Clustered Index Scan essentially scan all records
Since Graduating from a very small school in 2006 with a badly shaped &

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.