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 vs;

copy(istream_iterator(cin), istream_iterator(), back_inserter(vs));

// 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!