I'm having a problem getting my buffer(string) to print out everything that the user inputs. When I run my code the buffer only prints out the last thing that is inputted. I've tried just about everything and I really do not know what else to do. I'm new to c++ so I have not got familiar with the language just yet. Any help would be greatly appreciated.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
string quote;
string answer;
cout<< "Enter user name: ";
cin>> name;
cout<< "Enter the quote: ";
cin>> quote;
cout<< "\nAny more users?(enter yes or no) ";
cin>> answer;
do
{
cout<< "\nEnter user name: ";
cin>> name;
cout<< "Enter the quote: ";
cin >> quote;
cout<< "\nAny more users?(enter yes or no): ";
cin>> answer;
} while (answer == "yes");
if(answer == "no")
{
string buffer;
buffer = "The buffer contains:\n ";
cout<< buffer << name << ": " << quote;
}
else
cout<< "Invalid response";
}