0

Is this possible to print Point value?

For the example, I have a Point like this:

Point coordinate = Point(150,300);

And I want to show its value. I tried several ways, like:

first:

cout << coordinate << "\n";

second:

cout << coordinate.x << coordinate.y << "\n";

I also try the suggestion to flush it, become:

std::cout << coordinate << std::endl;

But none of those are work in my case. Is there any suggestion? Thanks for your help. Ps. I work with opencv 3 and c++

Berlian
  • 57
  • 2
  • 10

1 Answers1

0
std::cout << coordinate.x << "," << coordinate.y << std::endl;
trigras
  • 515
  • 6
  • 18
  • 4
    Thank you for this code snippet, which may provide some immediate help. A proper explanation [would greatly improve](//meta.stackexchange.com/q/114762) its educational value by showing *why* this is a good solution to the problem, and would make it more useful to future readers with similar, but not identical, questions. Please [edit] your answer to add explanation, and give an indication of what limitations and assumptions apply. – Toby Speight Aug 01 '17 at 11:30