c++ - How to print the position -



c++ - How to print the position -

since x_str,y_str local, not getting right output in function. (illegal chars printed in place of x_str , y_str) dont want add together 2 more fellow member variables x_str,y_str class.

hence replacement of function right output.

string pos::getposreport(){ string x_str; x_str = x; string y_str; y_str = y; homecoming 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(); };

std::stringstream ss; ss << "(" << x << "," << y << ")"; homecoming ss;

(this whole function body).

c++ string

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -