Basically I want to fill a vector of strings (I thought of doing it with a for), the vector will receive the data through the keyboard (with cin). So far so good but I have no idea how to do to stop the cycle and stop filling the vector at the time I want. That is, it could make a maximum size not very large and when it gets there it would end. But I want it to be variable. I had thought then of conditioning the cycle with a while but I have no idea what it is that has to be in the while to work. I have done this:
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
/*
*/
int main(int argc, char** argv) {
int tam = 1000;
string collar[tam];
cout << "Introduce el nombre de una mazmorra: " ;
cout << "Cuando termines de introducir datos pulsa 0";
do{
for (int i = 0; i < tam; i++)
cin >> collar[i];
}while ();
return 0;
}
I thought about conditioning 0, but anything helps me. Also, if someone thinks that all this can be done in a simpler way or whatever, I would also like to know:).