I am new to cpp and have a situation in which I want to split array string
I have
for( i = k = 0; i < points[1].size(); i++ )
{
cout << points[1][k];
}
Output >>
[390.826, 69.2596]
[500.324, 92.9649]
[475.391, 132.093]
[5.60519e-44, 4.62428e-44]
I want
390.826
69.2596
500.324
92.9649
475.391
132.093
5.60519e-44
4.62428e-44
Please help me.Thanks
Assuming the type of point has
publicmembersxandy:If the members are something else, say,
XandY(the uppercase), then use the uppercase instead (or whatever it is).The reason why you code prints the output that way, because
operator<<has been overloaded for the type of the point. Something like:If you can search the above definition (or something similar) somewhere in your project source code, and then can change that to this:
then you wouldn’t need to change the code in your
forloop.