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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:55:54+00:00 2026-06-17T12:55:54+00:00

I am new to C++ and am trying to make a program to allow

  • 0

I am new to C++ and am trying to make a program to allow whoever is running the program to write to a list, and when they are done typing “exit” and it will display the list. I am lost on how to achieve this, could anyone help?

Here is what I have :

#include <iostream>
#include <string>
#include <unistd.h>
#include <math.h>
#include <vector>

using namespace std;
int main()
{
    string uid;
    write(1,"\E[H\E[2J",7);
    cout << "Enter UID: ";
    cin >> uid;
    cout << "DB: \n\n" << uid << " \n\n""end\n\n";
    return 0;
}

How I could I put that in a loop such that they each could keep writing to the list until they type “exit”?

  • 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-06-17T12:55:55+00:00Added an answer on June 17, 2026 at 12:55 pm

    Since this question doesn’t show much effort, I’ll give a complicated answer you have no chance of understanding…

    std::vector<std::string> list;
    for(std::string i; std::cin >> i && i != "exit"; list.push_back(i));
    std::copy(list.begin(), list.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
    

    .. But is possibly the smallest way to do it (I’m sure someone will make a smaller one now that I said that)

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

Sidebar

Related Questions

I am trying to make a simple program that could open a new activity
I'm new to iPhone programming, and I'm trying to make a simple program without
Im new to android and i am trying to make a program that outputs
Trying to make program run on list of urls and open limited number of
hello im new and learning javascript. I'm trying to make a program of addition
I'm trying to make a program that will draw lines over a picturebox using
I'm relatively new to programming. I'm trying to make a program at the moment,
Hello i am new to C++ and im trying to make a program that
I'm trying to make an actionscript program that will be able to read an
I'm new at Java GUI and I'm trying to make a program that shows

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.