Question: Use a library algorithm to concatenate the strings in a vector. I've provided a template that reads in the data and prints the result; all
Use a library algorithm to concatenate the strings in a vector. I've provided a template that reads in the data and prints the result; all you need to do is to provide the one line of code that concatenates the strings.
For example, if the strings in the vector are "Bill", "Charlie", Percy", "George", "Fred", "Ron", "Ginny", the resulting string would be "BillCharlieFredGeorgeGinnyPercyRon".
Hint: remember that strings are concatenated using the + operator.
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{
vector
copy(istream_iterator
// Sort the strings
YOUR CODE GOES HERE
// Concatenate the strings into a single string.
string s = YOUR CODE GOES HERE
cout << s << ' ';
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
