I've been trying to write this code on concatenated strings:
#include<iostream>
#include<string>
using namespace std;
int main (){
string line, total;
//Read strings from the input//
cout<<"Enter a String"<< endl;
while(getline(cin,line)){
cout<< "Enter another String"<< endl;
if(!line.empty())
total+=line;
cout<<" Concatenated string is\t"<<total<< endl;
}
return 0;
}
However, my output has no space existing between the two appended strings. I also need a way to terminate the added strings.