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”?
Since this question doesn’t show much effort, I’ll give a complicated answer you have no chance of understanding…
.. But is possibly the smallest way to do it (I’m sure someone will make a smaller one now that I said that)