Skip to content

Commit

Permalink
Update ex3_4b.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooophy committed Jun 21, 2015
1 parent 54f4c7f commit 2eed0aa
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions ch03/ex3_4b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ using std::endl;

int main()
{
string str1, str2;
while (cin >> str1 >> str2)
{
if (str1.size() == str2.size())
cout << "The two strings have the same length." << endl;
else
cout << "The longer string is " << ((str1.size() > str2.size()) ? str1 : str2);
}
for (string str1, str2; cin >> str1 >> str2;/* */)
{
if (str1.size() == str2.size())
cout << "The two strings have the same length." << endl;
else
cout << "The longer string is " << ((str1.size() > str2.size()) ? str1 : str2) << endl;
}

return 0;
return 0;
}

0 comments on commit 2eed0aa

Please sign in to comment.