#include<vector> #include<iostream> using namespace std; int main() { vector<string> list; cout<<"Please enter the names, press Q to quit:"<<endl; string name; //string // while(name!="Q") { cin>>name; list.push_back(name); //pushing string to the list } list.pop_back(); //poping string from the list list.pop_back(); cout<<"You have entered "<<list.size()<<" names:"<<endl; for(int i=0; i<list.size(); i++) { cout<<list[i]<<endl; } return 0; }