Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6665199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:41:52+00:00 2026-05-26T02:41:52+00:00

I am new to cpp and have a situation in which I want to

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:41:52+00:00Added an answer on May 26, 2026 at 2:41 am

    Assuming the type of point has public members x and y:

    for( i = k = 0; i < points[1].size(); i++ )
    {
        cout << points[1][k].x << endl;
        cout << points[1][k].y << endl;
    }
    

    If the members are something else, say, X and Y (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:

    std::ostream & operator<<(std::ostream & out, const point &p)
    {
        return out << "[" << p.x << "," << p.y << "]\n"; 
    }
    

    If you can search the above definition (or something similar) somewhere in your project source code, and then can change that to this:

    std::ostream & operator<<(std::ostream & out, const point &p)
    {
        return out << p.x << "\n" << p.y << "\n"; 
    }
    

    then you wouldn’t need to change the code in your for loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to NDK. I have a cpp file which has the following
Situation : I have a Dialog class in Qt on which I draw a
Situation is following. I have shared library, which contains class definition - QueueClass :
I'm new to c++ and i want to compile my testprogram . i have
How can I copy diff output ( diff old-version.cpp new-version.cpp ) into an Outlook
I have a file.cpp which i'm porting to linux from windows. I've changed all
I have a rather standard situation where I want to use a templated class
I am new to cpp and have a question regarding arrays. The code I
I am fairly new to cpp but have been in c# for a while.
New to cpp (Java guy). I have 3rd party library that has method sendMail(txt).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.