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 3323828
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:20:56+00:00 2026-05-17T23:20:56+00:00

Example of input: I 67 85 49 R 4 D 4 G 65 97

  • 0

Example of input:

I 67 85 49

R 4

D 4

G 65 97

/end input.txt

So I’m sure this is a elementary programming question but i’ve been playing with code and tried looking it up in books. But I need a way to keep reading in numbers after the I because theoretically the numbers could be endless. Now the D,G,R I can just code it to read in one number for D and R and two for G because that will never change.

By the way, I stands for Insert, R for Rank, D for delete, and G for Range. It’s a program on BSTs. Got most of my code done except for parts of my main and little things here and there.

I was thinking of a while() loop in my switch to do this feat, but I’m pretty I’ll have to change up my coding a bit inside the while loop.

I got it working so it reads in the operations perfectly.

Thanks for any suggestions!

Code:

inFile >> oper;     //prime the while loop

while(!inFile.eof())
{
    switch(oper)
        {
            case 'I':   while(//something to stop at /n)
                            {
                                    inFile >> value;      //tests to see if it
                        outFile << value; //is working correctly
                                    MainInsert(value);
                            }
                        break;
            case 'D':   
                        break;
            case 'R':   
                        break;
            case 'G':   
                        break;
            case 'F':   
                        break;
            case 'S':   
                        break;
            default:    outFile << "\n Invalid Operation!" << endl;
                        exit (0);
        }

    inFile >> oper;
}
  • 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-17T23:20:56+00:00Added an answer on May 17, 2026 at 11:20 pm
    case 'I':
    {
        std::string str;
        std::getline(inFile, str);
        std::istringstream iss(str);
        iss >> value;
        while(iss)
        {
            outFile << value;
            MainInsert(value);
            iss >> value;
        }
        break;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been staring at this for hours, but am not sure what i'm doing
Example input: SERVER_NAME=server1 PROFILE_NAME=profile1 ... Example output: SERVER_NAME=server3 PROFILE_NAME=profile3 ... This file will use
For example I have a css style like this : input.validation-passed {border: 1px solid
I am new to Rails so this is probably an easy question but can't
For example : input = 360 seconds output = 6 minutes input = 86400
How to split a string in SQL Server. Example: Input string: stack over flow
Example user input: PA1 9 //correct PJ1 9 //wrong, error printed Invalid row because
for example, I want the textfield input number only. my idea is when the
Here is an example of what I'd expect: Input: a { background: red; }
For example, if I'm doing some form input validation and I'm using the following

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.