Skip to content

Commit

Permalink
Merge pull request pezy#2 from pezy/master
Browse files Browse the repository at this point in the history
improving ex6_17
  • Loading branch information
sanerror authored Oct 16, 2016
2 parents 6c4e66f + 50e8a37 commit f8967fc
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions ch06/ex6_17.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <iostream>
#include <string>

using std::cout;
using std::endl;
using std::string;

bool hasUppercase(const string& str)
Expand All @@ -12,18 +10,16 @@ bool hasUppercase(const string& str)
return false;
}

void makeLowercase(string& str)
const string& makeLowercase(string& str)
{
for (auto& c : str)
if (isupper(c)) c = tolower(c);
return str;
}

int main()
{
string str("Hello World!");
cout << hasUppercase(str) << endl;
makeLowercase(str);
cout << str << endl;

return 0;
std::cout << std::boolalpha << hasUppercase(str) << std::endl;
std::cout << makeLowercase(str) << std::endl;
}

0 comments on commit f8967fc

Please sign in to comment.