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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started