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

Situation is following. I have shared library, which contains class definition - QueueClass :
How can I copy diff output ( diff old-version.cpp new-version.cpp ) into an Outlook
I have many source/text file, say file.cpp or file.txt . Now, I want to
I have started a new project consisting of one main.cpp file and an additional
I am new to cpp, I have a small problem, I have a cpp
Since starting at a new company I've noticed that they use unity cpp files
I created a new HalloWorld Makefile Project. There is a HalloWorld.cpp with my main
New to both Ruby and Rails but I'm book educated by now (which apparently
I would like to know how you normally deal with this situation: I have
I have a class in the file AType.h and it is implemented in AType.cpp.

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.