So I have to send to std::cout
a column of data where I have to also display some characters around the data like:
Plot Points
(0,0), (2,3)
(1,10), (12,14)
where I have to right justify the last right parenthesis under the letter "s"
in "Points"
in the column header.
I am putting the data out like:
cout << right << setw(12) << "(" << x1 << "," << y1 << "), (" << x2 << "," << y2 << ")";
But all the examples I have seen seem to show that the right and setw
only seem to affect the next piece of data I send to cout
, so in this case the "("
only.
Is there any way to group all those characters and variables together to have them all justified together in the column of output?
I'm just learning C++ so expect there is some simple solution I haven't learned yet?