fork download
  1. #include <iostream>
  2. #include <sstream>
  3.  
  4. using namespace std;
  5.  
  6. class Position
  7. {
  8. public:
  9. int x;
  10. int y;
  11.  
  12. Position(int x, int y) : x(x), y(y) { }
  13. };
  14.  
  15. int main()
  16. {
  17. Position p(10, 4);
  18. stringstream ss;
  19. ss << "yourPositionX = " << p.x << "\r\nyourPositionY = " << p.y << "\r\n\r\n";
  20. cout << ss.str();
  21. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
yourPositionX = 10
yourPositionY = 4