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

  • Home
  • SEARCH
  • 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 6098397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:09:13+00:00 2026-05-23T13:09:13+00:00

I need simple program in C++ that will open text file and going line

  • 0

I need simple program in C++ that will open text file and going line by line find second argument by knowing first in list.

Content of text file:

1, red
2, blue
3, green
4, orange

So I need a program that will go line by line and each line turn into array ( of two elements ) and then compare first element with user interactively inserted number.

So if user insert 2, it goes line by line, comparing first element of array-ed line and if it matches, it prints second element in array ( blue ), and if user type 3, it prints green…

I have always working in PHP, and it’s much easier than this, so I am stuck a little bit with this now… :/

  • 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-23T13:09:13+00:00Added an answer on May 23, 2026 at 1:09 pm

    Q1: How do you open text file in C++ ?
    Q2: How do you read file line by line?

    C++ Input/Output with files

    Q3: How do you turn string with “,” into array based on that delimiter?

    How to split a string in C++?

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

Sidebar

Related Questions

In my program I need to open a file using an external application (Bentley
I have the need to express simple conditionals as program input. The input must
I need a simple way to monitor multiple text log files distributed over a
I need a simple function which will take a FileInfo and a destination_directory_name as
Well... that's it. I need something simple and reliable (doesn't have to have fancy
How can I write a program that will automatically generate a sample examination? For
I am trying to write a simple program that lets me overlay a dot
I'm making a relatively simple program which will also be running on a few
I have a simple file transfer socket program where one socket sends file data
I need a simple table with a user name and password field in MySQL.

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.