Skip to content

Commit

Permalink
Update ex3_5b.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooophy committed Jun 21, 2015
1 parent c45c0d5 commit c49dd60
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions ch03/ex3_5b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@ using std::endl;

int main()
{
string largeStr;
string str;
while (cin >> str)
{
if (largeStr.empty())
largeStr += str;
else
largeStr += " " + str;
}
string str;
for (string buff; cin >> buff; str += (str.empty() ? "" : " ") + buff);
cout << "The concatenated string is " << str << endl;

cout << "The concatenated string is " << largeStr << endl;

return 0;
return 0;
}

0 comments on commit c49dd60

Please sign in to comment.